:root {
  --ink: #17343a;
  --muted: #64777b;
  --brand: #173f46;
  --brand-soft: #e7f0ef;
  --paper: #ffffff;
  --bg: #f5f7f6;
  --line: #dce4e2;
  --accent: #d9a441;
  --accent-soft: #fff4da;
  --shadow: 0 16px 42px rgba(25, 55, 59, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button { color: inherit; }

.topbar {
  height: 72px;
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--brand);
  color: white;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 64px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: white; overflow: hidden;
}
.brand-mark img { width: 58px; height: 32px; object-fit: contain; display: block; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand span { margin-top: 2px; font-size: 12px; opacity: .72; }
.icon-button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.38); background: transparent;
  color: white; font-weight: 700; cursor: pointer;
}

main { min-height: calc(100vh - 110px); }
.hero {
  padding: 34px 20px 23px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.hero > * { max-width: 800px; margin-left: auto; margin-right: auto; }
h1 { margin-top: 0; margin-bottom: 6px; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.035em; }
.hero > p { margin-top: 0; margin-bottom: 20px; color: var(--muted); font-size: 16px; }
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 17px; top: 50%; width: 21px; height: 21px;
  transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
#searchInput {
  width: 100%; height: 58px; padding: 0 50px 0 50px;
  border: 2px solid #c7d3d1; border-radius: 15px; outline: none;
  background: #fff; color: var(--ink); font-size: 17px;
  transition: border-color .15s, box-shadow .15s;
}
#searchInput:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23,63,70,.10); }
.clear-button {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; opacity: 0;
}
.search-wrap.has-value .clear-button { opacity: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 15px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; padding: 8px 13px; font-size: 13px; font-weight: 650; cursor: pointer;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.hero-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.rules-button {
  display: block; margin: 0; padding: 7px 11px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  color: var(--brand); font-size: 12px; font-weight: 750; cursor: pointer;
}
.feedback-shortcut { background: var(--brand-soft); border-color: #c8d8d5; }

.content-section { max-width: 840px; margin: 0 auto; padding: 26px 20px 44px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.section-heading span { color: var(--muted); font-size: 12px; }
.popular-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.popular-card, .result-card {
  border: 1px solid var(--line); background: var(--paper); cursor: pointer; text-align: left;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.popular-card:hover, .result-card:hover { transform: translateY(-1px); border-color: #afc1be; box-shadow: 0 8px 25px rgba(23,63,70,.07); }
.popular-card { min-height: 105px; padding: 15px; border-radius: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.organ-tag { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.popular-card strong { font-size: 15px; line-height: 1.25; }
.popular-card small { color: var(--brand); font-weight: 700; }
.recent-block { margin-top: 28px; }
.result-list { display: grid; gap: 9px; }
.result-card { width: 100%; border-radius: 14px; padding: 14px 15px; display: grid; grid-template-columns: 1fr auto; gap: 5px 15px; align-items: center; }
.result-card .result-main { min-width: 0; }
.result-card .result-main strong { display: block; font-size: 15px; line-height: 1.32; }
.result-card .result-main span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.result-card .result-time { text-align: right; white-space: nowrap; }
.result-card .result-time strong { display: block; font-weight: 850; font-size: 15px; color: var(--brand); }
.result-card .result-time small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 650; }
.verification-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.empty-state { padding: 34px 22px; border: 1px dashed #bdcac8; border-radius: 14px; background: white; text-align: center; }
.empty-state p { color: var(--muted); line-height: 1.5; }
.secondary-button { border: 1px solid var(--brand); border-radius: 10px; padding: 10px 14px; color: var(--brand); background: white; font-weight: 700; cursor: pointer; }

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(14, 35, 39, .48); backdrop-filter: blur(2px); }
.detail-dialog, .info-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
.detail-dialog article, .info-dialog article { position: relative; padding: 25px; border-radius: 20px; background: white; box-shadow: var(--shadow); overflow: auto; }
.dialog-close { position: absolute; right: 14px; top: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--bg); font-size: 25px; cursor: pointer; }
.eyebrow { margin: 12px 0 6px; color: var(--muted); font-weight: 750; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.detail-dialog h2 { margin: 0 44px 18px 0; font-size: 24px; line-height: 1.18; letter-spacing: -.025em; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 9px; background: var(--accent-soft); color: #805b15; font-size: 11px; font-weight: 800; }
.registration-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.registration-row { min-height: 54px; padding: 10px 14px; display: grid; grid-template-columns: 125px 1fr; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.registration-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.registration-row strong { font-size: 16px; line-height: 1.25; }
.code-row strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; letter-spacing: .02em; }
.code-description { margin: 0; padding: 12px 14px; color: var(--muted); font-size: 13px; line-height: 1.45; background: #fafbfb; }
.time-panel { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.time-panel > div { min-height: 76px; padding: 11px 8px; border: 1px solid var(--line); border-radius: 12px; display: grid; place-content: center; text-align: center; }
.time-panel span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.time-panel strong { display: block; margin-top: 4px; font-size: 18px; }
.time-panel .time-total { color: white; background: var(--brand); border-color: var(--brand); }
.time-panel .time-total span { color: rgba(255,255,255,.72); }
.note { margin-top: 13px; padding: 12px 13px; border-left: 4px solid var(--brand); border-radius: 4px 10px 10px 4px; background: var(--brand-soft); font-size: 13px; line-height: 1.45; }
.note.warning { border-color: var(--accent); background: var(--accent-soft); }
.alternatives { margin-top: 17px; }
.alternatives h3 { margin: 0 0 8px; font-size: 13px; }
#alternativeButtons { display: grid; gap: 7px; }
.alternative-button { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; text-align: left; font-size: 13px; font-weight: 700; cursor: pointer; }
.microcopy { margin: 17px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.info-dialog h2 { margin-top: 8px; }
.info-dialog p, .info-dialog li { color: var(--muted); line-height: 1.55; font-size: 14px; }
.info-dialog li + li { margin-top: 5px; }
.rules-list { padding-left: 20px; }
.rules-list strong { color: var(--ink); }
.info-dialog .version { margin-top: 22px; font-size: 11px; }
.feedback-button, .primary-button {
  width: 100%; margin-top: 10px; padding: 11px 14px; border: 1px solid var(--brand);
  border-radius: 10px; background: white; color: var(--brand); font-weight: 750; cursor: pointer;
}
.primary-button { background: var(--brand); color: white; }
.feedback-text {
  width: 100%; padding: 12px; resize: vertical; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: white; line-height: 1.45;
}
.feedback-text:focus { outline: 2px solid rgba(23,63,70,.18); border-color: var(--brand); }
.feedback-status { min-height: 20px; margin-bottom: 0; font-size: 12px !important; }
footer { padding: 14px 20px max(14px, env(safe-area-inset-bottom)); color: var(--muted); text-align: center; font-size: 11px; }
footer span, footer strong { display: block; }
footer strong { margin-top: 4px; color: var(--ink); font-weight: 700; }

@media (min-width: 700px) {
  .hero { padding-top: 46px; padding-bottom: 28px; }
  .popular-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-dialog article, .info-dialog article { padding: 30px; }
}

@media (max-width: 430px) {
  .brand-mark { width: 56px; }
  .brand-mark img { width: 51px; }
  .hero-actions { justify-content: flex-start; flex-wrap: wrap; }
  .registration-row { grid-template-columns: 105px 1fr; }
  .detail-dialog article, .info-dialog article { padding: 22px 17px; border-radius: 18px; }
  .detail-dialog { width: calc(100% - 14px); }
}
