/* 夜市紅燈籠暗色系：深夜底 + 麻辣紅 / 燈籠金（token 名沿用，值已換膚） */
:root {
  color-scheme: dark;
  --ink: #f7ecd9;
  --muted: #b9a68d;
  --line: rgba(158, 124, 82, 0.55);
  --canvas: #17131f;
  --panel: #241e2e;
  --panel-strong: #2b2437;
  --teal: #e8a33d;
  --teal-dark: #f0c674;
  --coral: #e0704f;
  --gold: #e8a33d;
  --indigo: #8fa3d9;
  --chili: #d7452e;
  --chili-dark: #a52d1c;
  --chili-light: #ff8a66;
  --shadow: 0 20px 64px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

/* 確保 hidden 屬性一定生效：部分元素的 class 設了 display，會蓋掉瀏覽器預設的 [hidden]{display:none}。 */
[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* 夜市夜空：上緣燈籠紅光暈 + 兩側金光 + 深夜漸層 */
  background:
    radial-gradient(circle at 50% -4%, rgba(215, 69, 46, 0.28), transparent 24rem),
    radial-gradient(circle at 8% 12%, rgba(232, 163, 61, 0.12), transparent 22rem),
    radial-gradient(circle at 92% 16%, rgba(232, 163, 61, 0.1), transparent 22rem),
    linear-gradient(180deg, #1a1322 0%, #17131f 46%, #201525 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family:
    Inter, "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

/* ---- 艋舺版版面：夜市街走逛式的單欄縱向流 ---- */
.mg-hero {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 20px 8px;
  text-align: center;
}

.mg-hero-corner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.mg-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mg-lanterns {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  min-height: 46px;
  margin-bottom: 10px;
  line-height: 0;
}

.mg-lanterns .deco-lantern {
  display: inline-block;
  animation: decoBob 4.2s ease-in-out infinite alternate;
}

.mg-lanterns .deco-lantern:nth-child(even) {
  margin-top: 12px;
  animation-delay: 0.9s;
}

.mg-lanterns .deco-lantern:nth-child(3n) {
  animation-delay: 1.7s;
}

.mg-hero .eyebrow {
  color: var(--chili-light);
}

.mg-hero .subtitle {
  margin-top: 10px;
  font-size: 1rem;
}

.mg-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 560px;
  margin: 20px auto 0;
  padding: 0;
  position: relative;
}

.mg-steps li {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 10px 8px 12px;
  border-radius: 14px;
  background: rgba(37, 30, 46, 0.92);
  border: 1px solid rgba(215, 69, 46, 0.45);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.mg-steps li span {
  display: block;
}

.mg-steps li b {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #e0704f, var(--chili-dark));
  color: #fff;
  font-size: 0.76rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.mg-main {
  max-width: 920px;
  margin: 20px auto 0;
  padding: 0 14px 26px;
  display: grid;
  gap: 20px;
}

.mg-capture,
.mg-result {
  min-width: 0;
  border: 1px solid rgba(232, 163, 61, 0.3);
  border-radius: 14px;
  background: rgba(37, 30, 46, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 20px;
}

.mg-capture {
  display: grid;
  gap: 14px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.mg-footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 4px 20px 34px;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.mg-footer a {
  color: var(--chili-light);
  font-weight: 800;
}

.mg-footer-note {
  margin-top: 4px;
  font-size: 0.76rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-inline: auto;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  font-weight: 900;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.94rem;
}

.status-pill,
.quality-badge,
.upload-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(232, 163, 61, 0.22);
  border-radius: 999px;
  background: rgba(232, 163, 61, 0.08);
  color: var(--teal-dark);
  padding: 7px 11px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.upload-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.upload-heading strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 460px;
  border-radius: 10px;
  border: 1.5px dashed rgba(247, 236, 217, 0.28);
  background:
    linear-gradient(135deg, rgba(48, 38, 60, 0.9), rgba(32, 25, 42, 0.86)),
    repeating-linear-gradient(90deg, rgba(247, 236, 217, 0.04), rgba(247, 236, 217, 0.04) 1px, transparent 1px, transparent 28px);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.preview-frame.dragging {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 3px rgba(232, 163, 61, 0.14);
}

.preview-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #121920;
}

/* 分析中：橫向光束對手掌上下反覆掃描 */
.scan-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 16%;
  background: linear-gradient(
    to bottom,
    rgba(255, 215, 106, 0) 0%,
    rgba(255, 215, 106, 0.16) 42%,
    rgba(255, 215, 106, 0.34) 50%,
    rgba(255, 215, 106, 0.16) 58%,
    rgba(255, 215, 106, 0) 100%
  );
  animation: scanUpDown 2.2s ease-in-out infinite alternate;
}

/* 光束中央的亮線 */
.scan-beam::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-1px);
  background: #ffe9a8;
  box-shadow: 0 0 14px 2px rgba(255, 233, 168, 0.85);
}

.scan-tag {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(143, 29, 16, 0.82);
  color: #ffe9d2;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  animation: scanTagPulse 1.4s ease-in-out infinite;
}

@keyframes scanUpDown {
  0% { top: -2%; }
  100% { top: 86%; }
}

@keyframes scanTagPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.empty-preview {
  width: min(78%, 320px);
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-preview strong {
  color: var(--ink);
  font-size: 1rem;
}

.empty-preview small {
  color: var(--muted);
}

.palm-icon {
  width: min(300px, 92%);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 20px 34px rgba(140, 92, 58, 0.24));
  animation: palmFloat 5s ease-in-out infinite;
  transform-origin: 50% 58%;
}

.palm-digits {
  animation: palmBreathe 5s ease-in-out infinite;
  transform-origin: 50% 58%;
}

.scanner {
  animation: scanSweep 2.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes palmFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-36px) rotate(1deg); }
}

@keyframes palmBreathe {
  0%, 100% { opacity: 0.92; }
  50% { opacity: 1; }
}

@keyframes scanSweep {
  0% { transform: translateY(40px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(1170px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .palm-icon,
  .palm-digits,
  .result-content {
    animation: none;
  }

  .scanner {
    display: none;
  }

  /* 避免移動光束造成不適：改為靜態提示 */
  .scan-beam {
    animation: none;
    top: 42%;
  }

  .scan-tag {
    animation: none;
  }
}

.capture-actions {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 82px;
  gap: 10px;
}

#palmImage {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.icon-button,
.file-button,
.camera-button,
.ghost-button,
.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 850;
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(232, 163, 61, 0.38);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(247, 236, 217, 0.12), rgba(247, 236, 217, 0.04));
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
}

#bigFontButton svg {
  fill: currentColor;
}

.icon-button:focus-visible,
.file-button:focus-visible,
.camera-button:focus-visible,
.ghost-button:focus-visible,
.primary-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.file-button,
.camera-button {
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.file-button {
  background: linear-gradient(180deg, #f0c674, var(--gold));
  color: #241e2e;
}

.camera-button {
  background: linear-gradient(180deg, #e0704f, var(--chili-dark));
  color: #fff;
}

.ghost-button {
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(247, 236, 217, 0.16);
  background: rgba(247, 236, 217, 0.09);
  color: var(--ink);
}

.ghost-button:disabled,
.camera-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

form {
  display: grid;
  gap: 18px;
}

/* 拍掌卡下方的設定列：手別／偏重並排，按鈕整排 */
.mg-controls {
  padding-top: 4px;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  align-items: start;
}

.mg-controls .segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mg-controls .focus-chips {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mg-controls .segmented span {
  justify-content: center;
  padding: 0 8px;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.mg-controls .primary-button,
.mg-controls .demo-button,
.mg-controls .privacy-note {
  grid-column: 1 / -1;
}

.mg-controls .primary-button {
  min-height: 52px;
  font-size: 1.05rem;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span,
select,
.text-input {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1c1626;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-weight: 760;
}

.segmented input:checked + span {
  border-color: rgba(232, 163, 61, 0.7);
  background: linear-gradient(180deg, rgba(232, 163, 61, 0.22), rgba(232, 163, 61, 0.08));
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(232, 163, 61, 0.18);
}

select {
  appearance: none;
  justify-content: flex-start;
  text-align: left;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.primary-button {
  position: relative;
  background: linear-gradient(135deg, #d7452e, #a52d1c);
  color: white;
  padding: 0 16px;
}

.primary-button:not(:disabled):hover,
.camera-button:not(:disabled):hover,
.icon-button:hover,
.file-button:hover {
  filter: brightness(0.96);
}

.loader {
  width: 18px;
  height: 18px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.privacy-note,
.disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.result-empty {
  padding: 34px 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.result-empty h2 {
  color: var(--ink);
  margin-bottom: 8px;
}

.result-content {
  min-height: 0;
  display: grid;
  gap: 14px;
  animation: resultReveal 0.5s ease both;
}

@keyframes resultReveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(158, 124, 82, 0.78);
}

.overview {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: rgba(181, 139, 44, 0.12);
  border: 1px solid rgba(181, 139, 44, 0.22);
  line-height: 1.7;
  font-weight: 700;
}

.insight-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.insight-grid article,
.lines-panel,
.advice-panel {
  border: 1px solid rgba(158, 124, 82, 0.95);
  background: rgba(247, 236, 217, 0.05);
  border-radius: 8px;
  padding: 13px;
}

.insight-grid p,
.lines-panel dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.lines-panel dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.lines-panel dl div {
  display: grid;
  gap: 4px;
}

.lines-panel dt {
  font-weight: 850;
  color: var(--teal-dark);
}

.advice-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.advice-panel li + li {
  margin-top: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 10;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  border-radius: 8px;
  background: #f7ecd9;
  color: #241e2e;
  padding: 12px 14px;
  box-shadow: 0 14px 40px rgba(23, 33, 43, 0.28);
  text-align: center;
  font-weight: 760;
}

.modal {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: 100%;
  display: grid;
  gap: 16px;
  border-radius: 8px;
  background: var(--panel-strong);
  border: 1px solid rgba(232, 163, 61, 0.35);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.text-input:focus,
select:focus,
.segmented span:focus-within {
  outline: 3px solid rgba(232, 163, 61, 0.16);
  border-color: rgba(232, 163, 61, 0.58);
}

.save-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.save-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.camera-modal {
  width: min(760px, calc(100% - 28px));
}

.card-modal {
  width: min(420px, calc(100% - 28px));
}

.card-preview-image {
  width: 100%;
  max-height: min(62vh, 640px);
  object-fit: contain;
  border-radius: 12px;
  background: #1c1626;
  -webkit-touch-callout: default;
  pointer-events: auto;
}

.card-modal .modal-actions {
  grid-template-columns: 1fr;
}

.camera-card {
  gap: 14px;
}

.camera-preview {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #121920;
  min-height: 360px;
  aspect-ratio: 4 / 3;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.radar-panel {
  border: 1px solid rgba(158, 124, 82, 0.95);
  background: rgba(247, 236, 217, 0.05);
  border-radius: 8px;
  padding: 13px 13px 6px;
}

.radar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.radar-head h3 {
  margin: 0;
}

.radar-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.radar-host {
  display: grid;
  place-items: center;
}

.radar-svg {
  width: min(300px, 100%);
  height: auto;
  overflow: visible;
}

.radar-ring {
  fill: none;
  stroke: rgba(247, 236, 217, 0.16);
  stroke-width: 1;
}

.radar-spoke {
  stroke: rgba(247, 236, 217, 0.16);
  stroke-width: 1;
}

.radar-area {
  fill: rgba(232, 163, 61, 0.26);
  stroke: var(--teal);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.radar-dot {
  fill: var(--teal-dark);
}

.radar-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.result-actions {
  display: grid;
  padding-top: 2px;
}

.result-actions .ghost-button {
  background: rgba(232, 163, 61, 0.1);
  color: var(--teal-dark);
  border: 1px solid rgba(232, 163, 61, 0.24);
}

.demo-button {
  width: 100%;
  background: rgba(224, 112, 79, 0.14);
  color: #ffb08f;
  border: 1px solid rgba(224, 112, 79, 0.4);
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 52vh;
  overflow: auto;
}

.history-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 236, 217, 0.05);
  padding: 10px;
  cursor: pointer;
}

.history-item:hover {
  border-color: rgba(232, 163, 61, 0.5);
  background: rgba(232, 163, 61, 0.05);
}

.history-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(232, 163, 61, 0.1);
  font-size: 1.5rem;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.history-meta strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.history-meta span {
  color: var(--muted);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .mg-hero {
    padding: 12px 14px 6px;
  }

  .mg-lanterns {
    gap: 14px;
    min-height: 36px;
    margin-bottom: 8px;
  }

  .mg-lanterns .deco-lantern:nth-child(1),
  .mg-lanterns .deco-lantern:nth-child(5) {
    display: none;
  }

  .mg-lanterns .deco-lantern svg {
    width: 26px;
    height: auto;
  }

  .mg-steps {
    gap: 6px;
    margin-top: 16px;
  }

  .mg-steps li {
    padding: 8px 4px 10px;
    font-size: 0.74rem;
    border-radius: 12px;
  }

  .mg-main {
    padding: 0 10px 22px;
    gap: 14px;
  }

  .mg-capture,
  .mg-result {
    padding: 14px;
    border-radius: 16px;
  }

  .mg-controls {
    grid-template-columns: 1fr;
  }

  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(1.7rem, 8.5vw, 2.4rem);
  }

  .upload-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-frame {
    aspect-ratio: 5 / 4;
    max-height: 280px;
  }

  .empty-preview {
    width: min(86%, 280px);
    gap: 6px;
  }

  .palm-icon {
    width: min(180px, 70%);
  }

  .capture-actions {
    grid-template-columns: 1fr 1fr;
  }

  .capture-actions .ghost-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .status-pill,
  .quality-badge {
    width: fit-content;
  }

  .segmented span {
    min-height: 40px;
    font-size: 0.88rem;
  }

  .ghost-button {
    width: 100%;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .camera-preview {
    min-height: 260px;
  }
}

/* ---- 艋舺副標題 ---- */
.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

/* ---- 艋舺在地美食命格推薦面板 ---- */
.monga-panel {
  margin: 4px 0 6px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(215, 69, 46, 0.22);
  background:
    radial-gradient(circle at 100% 0%, rgba(215, 69, 46, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(52, 36, 44, 0.96), rgba(40, 30, 44, 0.96));
}

.monga-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.monga-head .eyebrow {
  color: var(--chili-light);
}

.monga-head h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 900;
  color: var(--ink);
}

.monga-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.monga-chip {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffa285;
  background: rgba(215, 69, 46, 0.2);
  border: 1px solid rgba(215, 69, 46, 0.22);
}

.monga-hero {
  position: relative;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--chili) 0%, var(--chili-dark) 100%);
  box-shadow: 0 12px 30px rgba(165, 45, 28, 0.28);
}

.monga-hero-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.2);
}

.monga-hero h4 {
  margin: 2px 0 8px;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.15;
}

.monga-why {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
}

.monga-hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.monga-esg-note {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}

.monga-link {
  color: #fff;
  font-weight: 850;
  font-size: 0.86rem;
  text-decoration: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.55);
  padding-bottom: 1px;
}

.monga-link:hover {
  border-bottom-color: #fff;
}

.monga-route {
  margin-top: 16px;
}

.monga-route-title {
  font-size: 0.86rem;
  font-weight: 850;
  color: var(--teal-dark);
  margin-bottom: 8px;
}

.monga-stops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.monga-stop {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(232, 163, 61, 0.18);
  background: rgba(232, 163, 61, 0.05);
}

.monga-stop-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.monga-stop-head strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.monga-role {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--teal-dark);
  background: rgba(232, 163, 61, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
}

.monga-stop p {
  margin: 5px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.monga-esg-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.monga-esg {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(181, 139, 44, 0.1);
  border: 1px solid rgba(181, 139, 44, 0.22);
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffd98a;
}

.monga-esg span:first-child {
  font-size: 1.05rem;
}

.monga-foot-note {
  margin: 14px 0 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--muted);
}

/* 加點（由次高的命格軸決定） */
.monga-side {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(215, 69, 46, 0.42);
  background: rgba(215, 69, 46, 0.08);
}

.monga-side-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.monga-side-head strong {
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--ink);
}

.monga-side-badge {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 850;
  color: #ffb59a;
  background: rgba(215, 69, 46, 0.22);
}

.monga-side-price {
  margin-left: auto;
  font-size: 0.86rem;
  font-weight: 850;
  color: var(--teal-dark);
}

.monga-side p {
  margin: 6px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
}

.monga-side-esg {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 750;
  color: var(--muted);
}

/* 分數分佈形狀 → 份量建議 */
.monga-style {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(232, 163, 61, 0.2);
  background: rgba(232, 163, 61, 0.08);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--ink);
}

.monga-style b {
  color: var(--teal-dark);
}

.monga-slot {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
  color: #ffd98a;
  background: rgba(215, 69, 46, 0.2);
  vertical-align: middle;
}

.monga-stop p.monga-stop-why {
  margin-top: 4px;
  font-size: 0.78rem;
  color: rgba(185, 166, 141, 0.82);
}

/* 解讀主體：被 .retake-notice 擋住時整塊隱藏。
   沿用 .result-content 的 grid 間距，包一層之後排版才不會塌掉。 */
.reading-body {
  min-height: 0;
  display: grid;
  gap: 14px;
}

/* 照片品質不足時的攔截區塊 */
.retake-notice {
  margin: 8px 0 6px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(215, 69, 46, 0.4);
  background: rgba(215, 69, 46, 0.1);
}

.retake-notice h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--ink);
}

.retake-notice p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.retake-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 420px) {
  .monga-esg-row {
    grid-template-columns: 1fr;
  }

  .monga-hero h4 {
    font-size: 1.3rem;
  }
}

/* ---- 艋舺像素裝飾：兩側漂浮食物 + 標題小辣椒 ---- */
.side-deco {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 34px;
  pointer-events: none;
}

.side-deco-left {
  left: 14px;
}

.side-deco-right {
  right: 14px;
}

/* 寬螢幕才顯示，避免蓋到主要內容（內容欄 920px，1180 起兩側留白足夠） */
@media (min-width: 1180px) {
  .side-deco {
    display: flex;
  }
}

.side-deco .deco {
  line-height: 0;
  filter: drop-shadow(0 6px 14px rgba(215, 69, 46, 0.3));
  animation: decoBob 3.8s ease-in-out infinite alternate;
}

.side-deco .deco:nth-child(2) {
  animation-delay: 0.7s;
}

.side-deco .deco:nth-child(3) {
  animation-delay: 1.4s;
}

.side-deco .deco:nth-child(4) {
  animation-delay: 2.1s;
}

.side-deco-right .deco {
  animation-duration: 4.4s;
}

@keyframes decoBob {
  from { transform: translateY(-7px) rotate(-1.5deg); }
  to { transform: translateY(7px) rotate(1.5deg); }
}

.title-pixel {
  display: inline-block;
  margin-left: 12px;
  line-height: 0;
  vertical-align: baseline;
  animation: decoBob 3.2s ease-in-out infinite alternate;
}

.title-pixel svg {
  vertical-align: -4px;
}

@media (prefers-reduced-motion: reduce) {
  .side-deco .deco,
  .title-pixel {
    animation: none;
  }
}

/* 主推菜價格與到店資訊 */
.monga-price {
  margin-left: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 3px 10px;
  vertical-align: 4px;
}

.monga-visit {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.3);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
}

/* ---- 家辣完整菜單（夜市招牌風） ---- */
.mg-menu:empty {
  display: none;
}

.menu-details {
  border: 1px solid rgba(232, 163, 61, 0.3);
  border-radius: 14px;
  background: rgba(37, 30, 46, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu-details summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
}

.menu-details summary::-webkit-details-marker {
  display: none;
}

.menu-details summary:hover {
  background: rgba(232, 163, 61, 0.07);
}

.menu-title {
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--ink);
}

.menu-hint {
  font-size: 0.8rem;
  font-weight: 750;
  color: var(--muted);
}

.menu-details[open] summary {
  border-bottom: 1px solid rgba(232, 163, 61, 0.22);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px 26px;
  padding: 18px 20px 6px;
}

.menu-cat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(215, 69, 46, 0.5);
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--teal-dark);
}

.menu-sizes {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.88rem;
}

.menu-name {
  font-weight: 750;
  color: var(--ink);
}

.menu-dots {
  flex: 1;
  border-bottom: 1px dotted rgba(247, 236, 217, 0.28);
  transform: translateY(-3px);
}

.menu-price {
  font-weight: 850;
  color: var(--teal-dark);
  white-space: nowrap;
}

.menu-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 850;
  vertical-align: 2px;
}

.menu-badge-sig {
  background: rgba(232, 163, 61, 0.18);
  color: var(--teal-dark);
  border: 1px solid rgba(232, 163, 61, 0.4);
}

.menu-badge-ltd {
  background: rgba(215, 69, 46, 0.2);
  color: var(--chili-light);
  border: 1px solid rgba(215, 69, 46, 0.45);
}

.menu-visit {
  margin: 0;
  padding: 12px 20px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

/* ---- 青銀友善：大字模式（全站 rem 字級放大） ---- */
html.font-xl {
  font-size: 121%;
}

#bigFontButton.is-on {
  background: linear-gradient(180deg, #f0c674, var(--gold));
  border-color: #c9922e;
  color: #241e2e;
  box-shadow: 0 4px 10px rgba(232, 163, 61, 0.28);
}
