﻿:root {
  --bg: #f5f1ea;
  --surface: #fffdf8;
  --surface-2: #f1ebe2;
  --ink: #191716;
  --muted: #7c756c;
  --faint: #b9b0a5;
  --line: #e4dbcf;
  --accent: #d65f1f;
  --accent-2: #256d62;
  --accent-soft: #fff0e8;
  --shadow: 0 18px 48px rgba(40, 31, 22, 0.16);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  background: #252a2b;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
}

button,
input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  width: min(100vw, 480px);
  min-height: 100svh;
  margin: 0 auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, #f9f5ee 0, var(--bg) 44%, #ede6dc 100%);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 74px 1fr 48px;
  align-items: center;
  gap: 8px;
  min-height: calc(70px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 14px 10px;
  background: rgba(249, 245, 238, 0.88);
  border-bottom: 1px solid rgba(228, 219, 207, 0.78);
  backdrop-filter: blur(18px);
}

.brand-lockup { min-width: 0; text-align: center; }

.brand-lockup span,
.eyebrow {
  display: block;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.brand-lockup h1 {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0;
}

.header-button,
.icon-button,
.ghost-button,
.tab {
  border: 0;
  background: transparent;
  color: inherit;
}

.header-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0;
  color: var(--accent);
  font-weight: 800;
  text-align: left;
}

.header-button span:first-child { font-size: 24px; line-height: 1; }

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.74);
  color: #686158;
  box-shadow: inset 0 0 0 1px rgba(228, 219, 207, 0.9);
}

.photo-panel { padding: 14px 14px 0; }

.photo-frame {
  position: relative;
  height: min(46svh, 500px);
  min-height: 320px;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(37, 109, 98, 0.18), transparent 50%), #2f3330;
  box-shadow: var(--shadow);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.empty-state {
  position: absolute;
  inset: 12px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  color: #fffaf0;
  text-align: center;
}

.empty-state strong { font-size: 23px; line-height: 1.2; }

.empty-state span {
  max-width: 260px;
  color: rgba(255, 250, 240, 0.72);
  font-size: 14px;
  line-height: 1.55;
}

.scan-mark {
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 250, 240, 0.9);
  border-radius: 20px;
  background:
    linear-gradient(90deg, transparent 0 42%, rgba(255, 250, 240, 0.9) 42% 58%, transparent 58%),
    linear-gradient(180deg, transparent 0 42%, rgba(255, 250, 240, 0.9) 42% 58%, transparent 58%);
}

.focus-box {
  position: absolute;
  z-index: 3;
  border: 2px solid #fff7cf;
  border-radius: 8px;
  background: rgba(255, 247, 207, 0.26);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.38), 0 0 22px rgba(255, 247, 207, 0.42);
  transition: left 160ms ease, top 160ms ease, width 160ms ease, height 160ms ease;
}

.hidden { display: none !important; }

.photo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -16px 12px 0;
  padding: 14px 16px;
  position: relative;
  z-index: 4;
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 12px 32px rgba(40, 31, 22, 0.14);
  backdrop-filter: blur(18px);
}

.photo-footer strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.status-pill,
.count-badge {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eaf3ef;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.status-pill.busy { background: #fff0e8; color: var(--accent); }

.control-strip {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
  padding: 16px 16px 10px;
}

.capture-button,
.ghost-button {
  min-height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 900;
}

.capture-button {
  border: 0;
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 22px rgba(214, 95, 31, 0.24);
}

.capture-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.button-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 20px;
  line-height: 1;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.68);
  color: var(--accent-2);
}

.result-sheet { padding: 14px 14px calc(88px + var(--safe-bottom)); }

.sheet-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 10px;
}

.sheet-meta h2 {
  margin: 2px 0 0;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: 0;
}

.status {
  min-height: 40px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(228, 219, 207, 0.75);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.result-list {
  display: grid;
  gap: 10px;
}

.result-card {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(228, 219, 207, 0.82);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 20px rgba(40, 31, 22, 0.06);
}

.result-card.active {
  border-color: rgba(214, 95, 31, 0.38);
  background: var(--accent-soft);
  box-shadow: 0 12px 28px rgba(214, 95, 31, 0.13);
}

.translated {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.translated strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.18;
  font-weight: 950;
}

.translated span {
  flex: 0 0 auto;
  color: #514b43;
  font-size: 18px;
  font-weight: 950;
}

.original,
.note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.note { color: var(--faint); font-style: italic; }

.info-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8dfd3;
  color: #6c6359;
  font-size: 13px;
  font-weight: 950;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(100vw, 480px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  transform: translateX(-50%);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  border-top: 1px solid rgba(228, 219, 207, 0.82);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(18px);
}

.tab {
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 12px;
  color: #91887d;
  font-size: 12px;
  font-weight: 850;
}

.tab span:first-child { font-size: 22px; line-height: 1; }
.tab.active { background: #fff0e8; color: var(--accent); }

.settings-dialog {
  width: min(92vw, 420px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop { background: rgba(25, 23, 22, 0.48); }

.settings-dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.settings-dialog h2,
.settings-dialog p { margin: 0; }
.settings-dialog h2 { margin-top: 2px; font-size: 22px; }
.settings-dialog p { color: var(--muted); line-height: 1.55; }

.settings-dialog label {
  display: grid;
  gap: 8px;
  color: #655e55;
  font-weight: 850;
}

.settings-dialog input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fffaf3;
}

.full { width: 100%; }

@media (min-width: 760px) {
  body { padding: 24px 0; }
  .app-shell {
    min-height: 860px;
    border-radius: 26px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  }
  .tabbar { border-radius: 0 0 26px 26px; }
}
