/* V30 Final Integrated Clean Version */

/* Grid */
.v28-scope #grid,
.v28-scope #grid.grid,
#grid,
#grid.grid{
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  row-gap:24px !important;
  column-gap:6px !important;
  column-count:unset !important;
}

@media(max-width:1200px){
  .v28-scope #grid,
  .v28-scope #grid.grid,
  #grid,
  #grid.grid{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
}

@media(max-width:760px){
  .v28-scope #grid,
  .v28-scope #grid.grid,
  #grid,
  #grid.grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}

/* Card */
.v28-scope #grid .postcard-card,
#grid .postcard-card{
  display:block !important;
  background:#fff !important;
  border-radius:14px !important;
  padding:4px !important;
  box-shadow:0 8px 22px rgba(0,0,0,.08) !important;
  border:1px solid rgba(0,0,0,.04) !important;
  margin:0 !important;
  max-width:none !important;
  break-inside:avoid !important;
}

.v28-scope .postcard-card::before,
.postcard-card::before{
  display:none !important;
}

/* Photo */
.v28-scope #grid .postcard-photo,
#grid .postcard-photo{
  position:relative !important;
  width:100% !important;
  aspect-ratio:1/1 !important;
  height: auto !important; /* 讓 aspect-ratio 決定高度 */
  border-radius:12px !important;
  overflow:hidden !important;
  background:#f3f4ef !important;
  cursor:pointer !important;
  display: block !important;
}

.v28-scope #grid .postcard-photo.reposition-enabled,
#grid .postcard-photo.reposition-enabled{
  cursor:grab !important;
}

.v28-scope #grid .postcard-photo.reposition-enabled.is-dragging,
#grid .postcard-photo.reposition-enabled.is-dragging{
  cursor:grabbing !important;
}

.v28-scope #grid .postcard-photo img,
#grid .postcard-photo img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  object-position:center center !important;
  display:block !important;
  border-radius:12px !important;
  /* 避免載入前變形的關鍵 */
  aspect-ratio: 1/1 !important;
}

.v28-scope #grid .postcard-photo img.landscape,
#grid .postcard-photo img.landscape{
  object-position:left center !important;
}

/* Hover UI */
.v28-scope .postcard-hover-actions,
.postcard-hover-actions{
  position:absolute !important;
  inset:0 !important;
  opacity:0;
  pointer-events:none;
  transition:.18s ease;
  z-index:10 !important;
}

.v28-scope .postcard-card:hover .postcard-hover-actions,
.postcard-card:hover .postcard-hover-actions{
  opacity:1;
  pointer-events:auto;
}

.v28-scope .postcard-photo .float-btn,
.postcard-photo .float-btn{
  position:absolute !important;
  width:auto !important;
  height:auto !important;
  min-width:auto !important;
  min-height:auto !important;
  max-width:none !important;
  max-height:none !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  border:0 !important;
  border-radius:999px !important;
  padding:6px 9px !important;
  background:rgba(255,255,255,0.05) !important; /* 幾乎完全透明 */
  box-shadow:none !important; /* 移除陰影，看起來更輕透 */
  backdrop-filter:blur(8px) !important;
  -webkit-backdrop-filter:blur(8px) !important;
  transform:none !important;
  color:#ffffff !important;
  font-size:12px !important;
  font-weight:800 !important;
  cursor:pointer !important;
  line-height:1 !important;
  transition:none !important;
}

.v28-scope .postcard-photo .float-btn:hover,
.postcard-photo .float-btn:hover,
.v28-scope .postcard-photo .float-btn:active,
.postcard-photo .float-btn:active {
  transform:none !important;
  scale:1 !important;
  box-shadow:0 6px 16px rgba(0,0,0,.10) !important;
  filter:none !important;
}

.v28-scope .postcard-photo .map-btn,
.postcard-photo .map-btn{
  left:8px !important;
  top:8px !important;
  right:auto !important;
  bottom:auto !important;
}

.v28-scope .postcard-photo .like-btn,
.postcard-photo .like-btn{
  right:8px !important;
  top:8px !important;
  left:auto !important;
  bottom:auto !important;
  color:#a65b66 !important;
}

.v28-scope .postcard-photo .edit-btn,
.postcard-photo .edit-btn{
  left:8px !important;
  bottom:8px !important;
  right:auto !important;
  top:auto !important;
}

.v28-scope .postcard-photo .more-btn,
.postcard-photo .more-btn{
  right:8px !important;
  bottom:8px !important;
  left:auto !important;
  top:auto !important;
}

/* Menu */
.v28-scope .postcard-more-menu,
.postcard-more-menu{
  position:absolute;
  right:8px;
  bottom:44px;
  display:none;
  width:120px;
  padding:7px;
  border-radius:14px;
  background:rgba(255,255,255,.7); /* 30% 透明 */
  box-shadow:0 10px 24px rgba(0,0,0,.14);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  z-index:20;
}

.v28-scope .postcard-more-menu.show,
.postcard-more-menu.show{
  display:block;
}

.v28-scope .postcard-menu-action,
.postcard-menu-action{
  width:100% !important;
  border:0 !important;
  background:transparent !important; /* 扁平化，不要全域綠色背景 */
  border-radius:10px !important;
  padding:8px !important;
  text-align:left !important;
  cursor:pointer !important;
  font-weight:750 !important;
  color: #333333 !important; /* 一般文字顏色 */
  box-shadow: none !important; /* 移除全域按鈕陰影 */
}

.v28-scope .postcard-menu-action:hover,
.postcard-menu-action:hover{
  background:#f0f2e9 !important;
}

.v28-scope .postcard-menu-action.danger,
.postcard-menu-action.danger{
  color:#a85858 !important;
}

/* Info */
.v28-scope #grid .postcard-info,
#grid .postcard-info{
  margin:10px 0 0 0 !important;
  padding:0 2px 4px !important;
  background:transparent !important;
  box-shadow:none !important;
  border:none !important;
}

.v28-scope .postcard-title-row,
.postcard-title-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.v28-scope .postcard-title,
.postcard-title{
  font-size:15px;
  font-weight:800;
  color:#2b2f27;
  letter-spacing:.01em;
}

.v28-scope .postcard-coords,
.postcard-coords{
  margin-top:5px;
  font-size:13px;
  font-weight:600;
  color:#33382f;
  letter-spacing:.1px;
  cursor:pointer;
  user-select:text;
}

.v28-scope .postcard-taxonomy,
.postcard-taxonomy {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important; /* 絕對禁止換行 */
  gap: 6px !important;
  margin-top: 8px !important;
  width: 100% !important;
  overflow: hidden !important;
}

.v28-scope .postcard-country,
.postcard-country {
  display: inline-block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex-shrink: 1 !important; /* 優先縮減國家名稱 */
  min-width: 0 !important;   /* Flex 下的 ellipsis 必要條件 */
  color: #666f60 !important;
  font-size: 13px !important;
  font-weight: 650 !important;
}

.v28-scope .postcard-tag,
.postcard-tag {
  flex-shrink: 0 !important; /* 標籤不縮減 */
}

/* 讓愛心按鈕靠最右邊且不縮減 */
.v28-scope .postcard-like-inline,
.postcard-like-inline {
  margin-left: auto !important;
  flex-shrink: 0 !important;
}

/* Tag */
.v28-scope .postcard-tag,
.postcard-tag{
  display:inline-flex !important;
  align-items:center !important;
  gap:6px !important;
  padding:3px 10px !important;
  border-radius:999px !important;
  background:rgba(255,255,255,0.4) !important;
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important;
  border:none !important;
  box-shadow:0 2px 6px rgba(0,0,0,0.04) !important;
  font-size:12px !important;
  font-weight:700 !important;
  color:#2f2f2f !important;
  cursor:pointer;
  margin-right: 3px !important;
}

.v28-scope .tag-花::before,
.tag-花::before{
  content:"✿";
  color:#b98390;
}

.v28-scope .tag-蘑菇,
.tag-蘑菇{
  position:relative !important;
  padding-left:18px !important;
}

.v28-scope .tag-蘑菇::before,
.tag-蘑菇::before{
  content:"";
  position:absolute;
  left:6px;
  top:50%;
  transform:translateY(-65%);
  width:7.5px;
  height:5.5px;
  background:#8a6042;
  border-radius:9px 9px 4px 4px;
}

.v28-scope .tag-蘑菇::after,
.tag-蘑菇::after{
  content:"";
  position:absolute;
  left:9px;
  top:50%;
  transform:translateY(-5%);
  width:2.3px;
  height:5.2px;
  background:#8a6042;
  border-radius:2px;
}

.v28-scope .tag-隱藏,
.tag-隱藏{
  color:transparent !important;
  background-image:linear-gradient(90deg,#00c2ff,#38d16a,#ffd93d,#ff7a18,#ff2d95,#6c5ce7) !important;
  -webkit-background-clip:text !important;
  background-clip:text !important;
}

.v28-scope .tag-隱藏::before,
.tag-隱藏::before{
  content:"";
  width:6px;
  height:6px;
  border-radius:50%;
  background:linear-gradient(135deg,#00c2ff,#38d16a,#ffd93d,#ff7a18,#ff2d95,#6c5ce7);
}

/* Card actions */
.v28-scope .v30-card-actions,
.v30-card-actions{
  display:flex;
  gap:12px;
  margin-top:7px;
}

.v28-scope .v30-text-action,
.v30-text-action{
  border:0;
  background:transparent;
  color:#3f7650;
  padding:0;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}

/* Tag filter */
.tag-filter-row{
  display:flex;
  gap:8px;
  margin-top:10px;
  flex-wrap:wrap;
}

.tag-filter{
  border:0;
  border-radius:999px;
  padding:7px 13px;
  background:#f1f2ea;
  color:#4f584b;
  font-weight:750;
  cursor:pointer;
  transition:.16s ease;
}

.tag-filter.active{
  background:#6aa85e;
  color:white;
}

/* Edit Modal */
.edit-modal{
  position:fixed;
  inset:0;
  z-index:9999;
}

.edit-modal.hidden{
  display:none;
}

.edit-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(40,45,36,.48);
  backdrop-filter:blur(8px);
}

.edit-modal-panel{
  position:relative;
  z-index:2;
  width:min(420px,94vw); /* 稍微調寬一點 */
  margin:4vh auto 0;    /* 稍微往上提一點 */
  max-height:90vh;      /* 增加一點最大高度 */
  overflow-y:auto;
  overscroll-behavior:contain;
  -ms-overflow-style:none;
  scrollbar-width:none;
  background:#fffef8;
  border-radius:24px;
  padding:24px 24px 80px; /* 增加底部 padding (80px) 確保儲存鈕不被擋住 */
  box-shadow:0 28px 80px rgba(0,0,0,.2);
}

.edit-modal-panel::-webkit-scrollbar{
  width:0;
  height:0;
  display:none;
}

.edit-modal-panel h2{
  margin:0 0 18px;
  font-size:24px;
  color:#273020;
}

.edit-modal-panel label{
  display:block;
  margin:14px 0 6px;
  font-size:14px;
  font-weight:800;
  color:#273020;
}

.edit-modal-panel input,
.edit-modal-panel select{
  width:100%;
  border:1px solid rgba(0,0,0,.12);
  border-radius:16px;
  padding:13px 14px;
  font-size:13.5px; /* 統一字體大小 */
  background:#fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05); /* 增加陰影強度 */
  transition: all 0.2s ease;
}

.edit-modal-panel input:focus,
.edit-modal-panel select:focus {
  border-color: rgba(0,0,0,0.2) !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08) !important;
  outline: none;
}


.edit-modal-panel input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}



.edit-modal-close{
  position:absolute;
  right:16px;
  top:16px;
  width:38px;
  height:38px;
  border:0;
  border-radius:50%;
  background:#efefe8;
  cursor:pointer;
  font-size:18px;
  font-weight:900;
}

.edit-save-btn{
  width:100%;
  margin-top:40px;
  margin-bottom: 20px; /* 新增底部間距 */
  border:0;
  border-radius:18px;
  padding:14px;
  background:#76a966;
  color:#fff;
  font-size:16px;
  font-weight:900;
  cursor:pointer;
  position:relative;
  z-index:5;
  pointer-events:auto !important;
}

.edit-image-focus-preview{
  width:100%;
  aspect-ratio:1/1;
  margin-top:8px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:14px;
  overflow:hidden;
  background:#f4f5ef;
  cursor:grab;
  touch-action:none;
}

.edit-image-focus-preview.is-dragging{
  cursor:grabbing;
}

.edit-image-focus-preview img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:50% 50%;
  display:block;
  user-select:none;
  -webkit-user-drag:none;
  pointer-events:none;
}

.edit-image-focus-actions{
  margin-top:8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.edit-image-focus-actions small{
  color:#5e6858;
  font-size:12px;
  font-weight:650;
}

.edit-image-focus-reset{
  border:0;
  border-radius:999px;
  padding:7px 12px;
  background:#edf0e8;
  color:#2c3a27;
  font-weight:800;
  cursor:pointer;
}

/* Mobile */
@media(max-width:600px){
  .v28-scope #grid .postcard-card,
  #grid .postcard-card{
    padding:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    border:none !important;
  }

  .v28-scope #grid .postcard-photo,
  #grid .postcard-photo{
    border-radius:18px !important;
  }

  .v28-scope .postcard-hover-actions,
  .postcard-hover-actions{
    opacity:1;
    pointer-events:auto;
  }

  .v28-scope .postcard-coords,
 .postcard-coords{
  display:block !important;
  font-size:12px !important;
  margin-top:4px !important;
}

  .v28-scope .postcard-title,
  .postcard-title{
    font-size:11px !important;
    line-height:1.25 !important;
    letter-spacing:-.02em !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }

  .v28-scope .postcard-country,
  .postcard-country {
    max-width: 40% !important; /* 手機版空間更緊湊 */
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .v28-scope .postcard-tag,
  .postcard-tag{
    padding:2px 7px !important;
    font-size:10px !important;
  }
}

/* (已移除強制覆蓋 Modal 裡的 Open Google Map 按鈕舊樣式，改由 v28-modal.css 控制) */
/* 手機版：修正蘑菇 icon 與文字重疊 */
@media (max-width:600px){
  .v28-scope .tag-蘑菇,
  .tag-蘑菇{
    padding-left:22px !important;
    padding-right:8px !important;
  }

  .v28-scope .tag-蘑菇::before,
  .tag-蘑菇::before{
    left:7px !important;
    width:8px !important;
    height:5.8px !important;
  }

  .v28-scope .tag-蘑菇::after,
  .tag-蘑菇::after{
    left:10.2px !important;
    height:5.5px !important;
  }
}
/* =========================================================
   V30 Clean UI Overrides — no HTML / JS structure changes
   Purpose:
   1) keep existing grid/card/modal styles
   2) keep only the current Pikmin toolbar visible
   3) desktop upload tabs restored
   4) mobile upload uses only the central upload box
   5) prevent broad selectors from hiding unrelated controls
   ========================================================= */

/* Hide preview banner only; do not affect app functions */
#previewModeBanner {
  display: none !important;
}

/* Hide the temporary top test panel without touching the real toolbar */
.main > .control-panel,
.v28-scope > .control-panel,
.main > .top-bar,
.v28-scope > .top-bar {
  display: none !important;
}

/* Hide only legacy toolbars; keep the active Pikmin toolbar */
.toolbar:not(.pikmin-toolbar) {
  display: none !important;
}

.pikmin-toolbar,
.toolbar.pikmin-toolbar {
  display: flex !important;
}

/* Important: do NOT use broad button:not(.pikmin-pill) or input:not(...) selectors. */

/* Desktop / tablet upload UI: show all three tabs */
@media (min-width: 769px) {
  .upload-tabs {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #modeFileBtn,
  #modeDragBtn,
  #modePasteBtn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #mobileUploadFab {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Mobile upload sheet: only keep the central upload box */
@media (max-width: 768px) {
  body {
    flex-direction: column !important;
  }

  .main {
    padding: 16px !important;
  }

  .sidebar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: -100% !important;
    width: 100% !important;
    height: 78vh !important;
    padding: 12px !important;
    background: #fffdf2 !important;
    border-radius: 24px 24px 0 0 !important;
    z-index: 5000 !important;
    overflow-y: auto !important;
    transition: bottom 0.35s ease !important;
    box-shadow: 0 -18px 40px rgba(31, 48, 28, 0.18) !important;
  }

  .sidebar.open {
    bottom: 0 !important;
  }

  .brand {
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .brand h1 {
    font-size: 18px !important;
  }

  .brand p {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  /* Hide tab buttons on mobile */
  .upload-tabs,
  #modeFileBtn,
  #modeDragBtn,
  #modePasteBtn,
  #dragPanel,
  #pastePanel {
    display: none !important;
  }

  /* Keep the central click-to-upload box */
  #filePanel {
    display: block !important;
  }

  #selectFileBtn {
    display: flex !important;
    cursor: pointer !important;
  }

  .upload-box {
    min-height: 80px !important;
    padding: 8px !important;
    font-size: 13px !important;
  }

  .upload-box strong {
    font-size: 14px !important;
  }

  .upload-box small {
    font-size: 11px !important;
  }

  .input {
    padding: 9px !important;
    font-size: 13px !important;
    margin: 6px 0 !important;
  }

  .primary-button {
    padding: 10px !important;
    font-size: 14px !important;
  }

  #v28CreateFab,
  #v28CreateMenu {
    display: none !important;
  }
}

/* Matching floating action buttons */
#mobileUploadFab,
#v28CreateFab,
#scrollTopBtn,
.v28-create-fab.scroll-top-fab {
  width: 35px !important;
  height: 35px !important;
  min-width: 35px !important;
  min-height: 35px !important;
  right: 14px !important;
  border: none !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #8ccc6b !important;
  color: #ffffff !important;
  box-shadow: 0 10px 24px rgba(80, 140, 80, 0.32) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  z-index: 6000 !important;
}

#mobileUploadFab {
  position: fixed !important;
  bottom: 64px !important; 
  font-size: 22px !important;
}

#v28CreateFab,
#scrollTopBtn,
.v28-create-fab.scroll-top-fab {
  position: fixed !important;
  bottom: 24px !important;
  font-size: 0 !important;
}

#v28CreateFab svg,
#scrollTopBtn svg,
.v28-create-fab.scroll-top-fab svg {
  width: 20px !important;
  height: 20px !important;
  color: #ffffff !important;
  display: block !important;
  pointer-events: none !important;
}

#v28CreateFab:hover,
#mobileUploadFab:hover,
#scrollTopBtn:hover {
  transform: translateY(-3px) scale(1.05) !important;
}

#v28CreateFab:active,
#mobileUploadFab:active,
#scrollTopBtn:active {
  transform: scale(0.92) !important;
}
@media (max-width: 768px) {

  /* 🔥 手機只保留最後一組座標 */
  .postcard-coords:not(:last-of-type) {
    display: none !important;
  }

}

/* 座標可點擊感 */
.postcard-coords {
  cursor: pointer;
}

.postcard-coords:active {
  opacity: 0.6;
}
