/* 村民投票所（2026-10-01.5，js/ideas.js） */
/* 獵魔村的告示板：木頭框＋軟木板、上面一塊木頭招牌；許願單是一張一張用像素圖釘釘上去的紙（每張微微歪一點）
   紙上：狀態標籤、標題、內容、已完成／不採納的紅色印章、黃色便條紙的村長回覆、寫的人（頭像）、贊成▲／反對▼
   白天：亮的木頭、軟木、米白的紙；夜間：深色木頭、燈籠照著的軟木板、暗一點的紙（紙上的字、輸入框、按鈕照紙的顏色） */

.ideas-page { display: grid; gap: 14px; width: 100%; max-width: 1040px; margin: 0 auto; }

/* ───────── 告示板 ───────── */
.ib-board {
  --wood: #8a5a2e; --wood-l: #a8723c; --wood-d: #4e2f16; --cork: #c4955c; --cork-d: rgba(88, 52, 20, 0.34); --cork-l: rgba(255, 236, 200, 0.3);
  --paper: #fdf7e8; --paper-2: #f3e8cd; --ink: #2a1d12; --ink-2: #5f4a33;
  position: relative; padding: 10px; border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(60, 30, 10, 0.12) 0 2px, transparent 2px 13px, rgba(255, 220, 170, 0.08) 13px 15px, transparent 15px 23px),
    linear-gradient(var(--wood-l), var(--wood));
  border: 2px solid var(--wood-d);
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.35), inset 0 -3px 0 rgba(40, 20, 5, 0.35), 0 12px 26px -16px rgba(40, 20, 5, 0.7);
}
/* 四個角的鐵釘 */
.ib-board::before { content: ''; position: absolute; inset: 3px; pointer-events: none;
  background:
    radial-gradient(circle at 4px 4px, #f4e6c8 0 1.5px, #6a4a2a 2px 3px, transparent 3.5px) left top / 8px 8px no-repeat,
    radial-gradient(circle at 4px 4px, #f4e6c8 0 1.5px, #6a4a2a 2px 3px, transparent 3.5px) right top / 8px 8px no-repeat,
    radial-gradient(circle at 4px 4px, #f4e6c8 0 1.5px, #6a4a2a 2px 3px, transparent 3.5px) left bottom / 8px 8px no-repeat,
    radial-gradient(circle at 4px 4px, #f4e6c8 0 1.5px, #6a4a2a 2px 3px, transparent 3.5px) right bottom / 8px 8px no-repeat; }
.ib-cork { position: relative; padding: 14px 12px 20px; border: 3px solid var(--wood-d); border-radius: 4px;
  background-color: var(--cork);
  background-image: radial-gradient(var(--cork-d) 1px, transparent 1.6px), radial-gradient(var(--cork-l) 1px, transparent 1.6px), radial-gradient(rgba(88, 52, 20, 0.18) 2px, transparent 2.6px);
  background-size: 9px 9px, 13px 13px, 31px 31px; background-position: 0 0, 4px 6px, 11px 17px;
  box-shadow: inset 0 4px 10px rgba(40, 20, 5, 0.45), inset 0 0 0 1px rgba(255, 230, 190, 0.15); }
@media (min-width: 700px) { .ib-board { padding: 14px; } .ib-cork { padding: 18px 22px 26px; } }

/* 木頭招牌 */
.ib-sign { position: relative; display: grid; justify-items: center; gap: 3px; max-width: 640px; margin: 0 auto 14px; padding: 10px 18px 9px; text-align: center;
  color: #fbeed3; border: 3px solid #3e2410; border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(60, 30, 10, 0.16) 0 2px, transparent 2px 9px),
    linear-gradient(#b07a44, #8a5a2e);
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.35), inset 0 -2px 0 rgba(40, 20, 5, 0.4), 0 4px 0 rgba(40, 20, 5, 0.35); }
.ib-sign::before, .ib-sign::after { content: ''; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f4e6c8 0 1.5px, #6a4a2a 2px); }
.ib-sign::before { left: 7px; }
.ib-sign::after { right: 7px; }
.ib-sign-t { display: inline-flex; align-items: center; gap: 10px; font: 900 21px/1.25 var(--serif); letter-spacing: 0.12em; text-shadow: 0 2px 0 #3e2410; }
.ib-box { line-height: 0; --doll-ol: #2a1408; filter: drop-shadow(0 2px 0 rgba(40, 20, 5, 0.5)); }
.ib-box svg { display: block; }
.ib-sign-s { max-width: 34em; font-size: 12.5px; line-height: 1.5; color: #f6e2bb; }

/* 分頁、發起許願 */
.ib-bar { display: grid; gap: 10px; margin-bottom: 12px; }
.ib-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ib-tab { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; height: 40px; padding: 0 4px; border-radius: 5px; cursor: pointer;
  border: 2px solid var(--wood-d); background: linear-gradient(#efe2c2, #dcc79c); color: #4a3424; font: 800 13.5px/1 var(--font); white-space: nowrap;
  box-shadow: 0 3px 0 rgba(40, 20, 5, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.ib-tab:hover { background: linear-gradient(#f8eed4, #e6d3aa); color: var(--ink); }
.ib-tab.on { background: linear-gradient(#fffaea, #f6e8c6); color: var(--ink); border-color: #9a6a14; transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(40, 20, 5, 0.45), inset 0 0 0 2px #e8b54a; }
.ib-tab:focus-visible { outline: 2px solid #fff3b0; outline-offset: 2px; }
@media (max-width: 419px) { .ib-tab-ico { display: none; } }
.ib-tab-n { margin-left: 4px; min-width: 18px; padding: 1px 5px; border-radius: 999px; background: rgba(60, 30, 10, 0.14); font-size: 11.5px; line-height: 1.3; text-align: center; font-variant-numeric: tabular-nums; }
.ib-tab.on .ib-tab-n { background: #8e2a1e; color: #fbeed3; }
.ib-new { width: 100%; height: 44px; font-size: 15px; }
@media (min-width: 640px) {
  .ib-bar { display: flex; align-items: center; justify-content: space-between; }
  .ib-tabs { display: flex; flex-wrap: wrap; }
  .ib-tab { padding: 0 12px; font-size: 14px; }
  .ib-new { width: auto; }
}
.ib-count { margin: 0 0 10px; color: #fff4dc; font-weight: 700; text-shadow: 0 1px 2px rgba(40, 20, 5, 0.9), 0 0 6px rgba(40, 20, 5, 0.5); }
.ib-login { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; max-width: 560px; margin: 0 auto 12px; padding: 8px 12px;
  border-radius: 3px; background: var(--paper); color: var(--ink); box-shadow: 0 6px 12px -8px rgba(40, 20, 5, 0.7); }

/* ───────── 許願單（紙） ───────── */
.ib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px 18px; align-items: start; padding-top: 8px; }
.ib-slip, .ib-form, .ib-none { position: relative; color: var(--ink); border-radius: 3px;
  background: linear-gradient(var(--paper), var(--paper-2));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 12px 16px -12px rgba(40, 20, 5, 0.8), inset 0 0 0 1px rgba(120, 90, 50, 0.16); }
.ib-slip { display: grid; gap: 8px; min-width: 0; padding: 18px 14px 12px; transform: rotate(var(--tilt, 0deg)); }
.ib-slip.mine { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 12px 16px -12px rgba(40, 20, 5, 0.8), inset 0 0 0 2px rgba(232, 181, 74, 0.75); }
.ib-slip.st-declined { filter: saturate(0.4); }
.ib-slip.st-declined .ib-title, .ib-slip.st-declined .ib-body { opacity: 0.75; }
.ib-pin { position: absolute; top: -8px; left: 50%; z-index: 2; transform: translateX(-50%); line-height: 0; --doll-ol: #2a1408; filter: drop-shadow(1px 3px 0 rgba(40, 20, 5, 0.35)); }
.ib-pin svg { display: block; }
.ib-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ib-st { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; border: 1px solid currentColor; background: rgba(255, 255, 255, 0.55); }
.st-open .ib-st { color: #4a6074; }
.st-planned .ib-st { color: #237a43; }
.st-doing .ib-st { color: #a85e00; }
.st-done .ib-st { color: #a8261a; }
.st-declined .ib-st { color: #6e6e6e; }
.ib-mine { padding: 1px 7px; border-radius: 999px; background: #e8b54a; color: #2a1d12; font-size: 11.5px; font-weight: 800; }
.ib-title { margin: 0; padding-right: 4px; font: 900 17px/1.4 var(--font); color: var(--ink); overflow-wrap: anywhere; }
.ib-body { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
/* 已完成、不採納：歪歪的紅色印章 */
.ib-stamp { position: absolute; right: 10px; top: 10px; padding: 1px 7px; border: 3px double currentColor; border-radius: 6px; pointer-events: none;
  font: 900 16px/1.25 var(--serif); letter-spacing: 0.12em; transform: rotate(-12deg); opacity: 0.75; mix-blend-mode: multiply; }
.st-done .ib-top, .st-declined .ib-top { min-height: 30px; padding-right: 92px; }
.st-done .ib-stamp { color: #c0392b; }
.st-declined .ib-stamp { color: #6e6e6e; }
/* 村長回覆：黃色便條紙 */
.ib-reply { padding: 7px 10px 8px; border-radius: 2px; background: #fff1a8; border-left: 4px solid #e0b030; color: #3a2a10; transform: rotate(-0.6deg);
  box-shadow: 0 3px 6px -3px rgba(40, 20, 5, 0.45); }
.ib-reply b { font-size: 12.5px; }
.ib-reply-by { font-size: 12px; color: #6a5426; }
.ib-full { color: #a8261a; font-weight: 700; }
.ib-reply p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px dashed rgba(120, 90, 50, 0.4); }
.ib-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ib-head { flex: none; box-shadow: inset 0 0 0 1px rgba(120, 90, 50, 0.35); background: #efe2c2; }
.ib-who-t { display: grid; min-width: 0; line-height: 1.25; }
.ib-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.ib-when { font-size: 12px; color: var(--ink-2); }
/* 贊成▲／反對▼ */
.ib-votes { display: flex; gap: 6px; flex: none; }
.ib-vote { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 54px; height: 36px; padding: 0 10px; border-radius: 8px; cursor: pointer;
  border: 2px solid #b89c68; background: #fffaf0; color: #5f4a33; font: 800 14px/1 var(--font); font-variant-numeric: tabular-nums; box-shadow: 0 2px 0 #b89c68; }
.ib-vote:hover { border-color: #8a6a3a; }
.ib-vote:active { transform: translateY(2px); box-shadow: none; }
.ib-vote:disabled { opacity: 0.6; cursor: default; }
.ib-vote:focus-visible { outline: 2px solid #9a6a14; outline-offset: 2px; }
.ib-vote .iv-arrow { font-size: 12px; }
.ib-vote.up .iv-arrow { color: #2e9d62; }
.ib-vote.down .iv-arrow { color: #c0392b; }
.ib-vote.up.on { background: #2e9d62; border-color: #1d6b45; color: #fff; box-shadow: 0 2px 0 #1d6b45; }
.ib-vote.down.on { background: #c0392b; border-color: #8a2418; color: #fff; box-shadow: 0 2px 0 #8a2418; }
.ib-vote.on .iv-arrow { color: #fff; }
.ib-vote.pop { animation: iv-pop 0.35s ease-out; }
@keyframes iv-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.ib-own { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ib-admin { padding-top: 6px; border-top: 1px dashed rgba(120, 90, 50, 0.4); }
.ib-admin summary { cursor: pointer; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.ib-adm-body { display: grid; gap: 6px; margin-top: 6px; }
.ib-adm-body .row-end { margin-top: 0; }
.ib-slip.flash { animation: ib-pinned 0.6s ease-out; }
@keyframes ib-pinned { 0% { opacity: 0; transform: translateY(-16px) rotate(var(--tilt, 0deg)) scale(1.04); } 60% { opacity: 1; transform: translateY(2px) rotate(var(--tilt, 0deg)); } 100% { transform: rotate(var(--tilt, 0deg)); } }

/* 沒有單子 */
.ib-none { grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; max-width: 420px; margin: 8px auto 0; padding: 22px 18px; text-align: center; font-weight: 700; transform: rotate(-0.8deg); }
.ib-none-ico { font-size: 28px; }

/* ───────── 發起許願（一張空白的許願單） ───────── */
.ib-form { display: grid; gap: 10px; max-width: 640px; margin: 4px auto 18px; padding: 20px 16px 14px; transform: rotate(-0.3deg); background: linear-gradient(var(--paper), var(--paper-2)); }
.ib-form-t { margin: 0; font: 900 17px/1.3 var(--serif); color: var(--ink); }
.ib-field { display: grid; gap: 4px; }
.ib-lab { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.ib-cnt { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ib-cnt.full { color: #c0392b; }
.ib-form .input { width: 100%; background: rgba(255, 255, 255, 0.7); }
.ib-form textarea.input { resize: vertical; min-height: 96px; line-height: 1.6; }
.ib-form .row-end { margin-top: 0; }

/* ───────── 夜間：燈籠照著的告示板 ───────── */
[data-theme="night"] .ib-board {
  --wood: #3e2818; --wood-l: #553622; --wood-d: #1a0e06; --cork: #6a4a2c; --cork-d: rgba(0, 0, 0, 0.35); --cork-l: rgba(255, 220, 170, 0.09);
  --paper: #d8caa8; --paper-2: #c8b791; --ink: #1e140c; --ink-2: #463422;
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.12), inset 0 -3px 0 rgba(0, 0, 0, 0.4), 0 12px 26px -16px rgba(0, 0, 0, 0.9);
}
[data-theme="night"] .ib-cork { background-image: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255, 190, 90, 0.2), transparent 70%),
  radial-gradient(var(--cork-d) 1px, transparent 1.6px), radial-gradient(var(--cork-l) 1px, transparent 1.6px), radial-gradient(rgba(0, 0, 0, 0.2) 2px, transparent 2.6px);
  background-size: 100% 100%, 9px 9px, 13px 13px, 31px 31px; background-position: 0 0, 0 0, 4px 6px, 11px 17px; }
[data-theme="night"] .ib-sign { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 9px), linear-gradient(#6a4428, #4e301a); border-color: #1a0e06; }
[data-theme="night"] .ib-tab { background: linear-gradient(#cdbb92, #b8a47a); color: #2a1d12; }
[data-theme="night"] .ib-tab:hover { background: linear-gradient(#d8c8a2, #c4b088); }
[data-theme="night"] .ib-tab.on { background: linear-gradient(#e8dcbc, #d8c8a2); }
[data-theme="night"] .ib-tab:focus-visible { outline-color: #ffe08a; }
/* 紙上的東西照紙的顏色（不是夜間的深色） */
[data-theme="night"] .ib-slip, [data-theme="night"] .ib-form, [data-theme="night"] .ib-none, [data-theme="night"] .ib-login {
  color-scheme: light; --field: #f3ead2; --surface-2: #e6d9b8; --line: #b8a47a; --line-2: #a8925f; --line-3: #8a7448;
  --text: #1e140c; --text-2: #3a2a1a; --muted: #463422; --loss: #a82a1e; --gold-ink: #7d5510; }
[data-theme="night"] .ib-form .input, [data-theme="night"] .ib-slip .input { background-color: #f6eed8; color: #1e140c; }
[data-theme="night"] .ib-form .input::placeholder, [data-theme="night"] .ib-slip .input::placeholder { color: #8a7458; }
[data-theme="night"] .ib-vote { background: #f3ead2; border-color: #8a7448; box-shadow: 0 2px 0 #8a7448; color: #3a2a1a; }
[data-theme="night"] .ib-reply { background: #e8d88a; }
[data-theme="night"] .ib-head { background: #d8caa8; }

@media (prefers-reduced-motion: reduce) {
  .ib-slip.flash, .ib-vote.pop { animation: none; }
  .ib-tab.on { transform: none; }
}
