@font-face { font-family: "KERIS Baeum"; src: url("fonts/KERISBAEUM_R.otf"); font-weight: 400; font-display: swap; }
@font-face { font-family: "KERIS Baeum"; src: url("fonts/KERISBAEUM.otf"); font-weight: 700; font-display: swap; }
:root {
  --ground: #fff; --raised: #f4f4f3; --rule: #ececea; --text: #111; --muted: #5f6368;
  --ok: #1c6b43; --ok-bg: #dcf5e6; --warn: #8a3d0c; --warn-bg: #fff0d6;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body {
  height: 100dvh; max-width: 640px; margin: auto; display: flex; flex-direction: column;
  font: 400 16px/1.5 "KERIS Baeum", sans-serif; color: var(--text); background: var(--ground); word-break: keep-all;
}
.num, dd { font-variant-numeric: tabular-nums; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
h1 { font-size: 20px; }
h2 { font-size: 18px; line-height: 1.35; }
button { font: 700 16px/1.2 "KERIS Baeum", sans-serif; min-height: 48px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--raised); color: var(--text); cursor: pointer; }
button:active { transform: scale(.98); }
:focus-visible { outline: 3px solid #2b6fd6; outline-offset: 2px; }
#notice { padding: 10px 16px; background: var(--warn-bg); color: var(--warn); }

main { flex: 1; min-height: 0; display: none; flex-direction: column; }
[data-view=scan] #scan, [data-view=list] #list { display: flex; }

#camera { position: relative; flex: 0 0 38dvh; background: #1d1f20; overflow: hidden; display: grid; place-items: center; }
video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#frame { position: absolute; inset: 24% 10%; border: 3px solid #fff; border-radius: 8px; }
#start { position: relative; background: #fff; min-width: 180px; }
#result { padding: 16px; min-height: 132px; background: var(--raised); }
#state { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
#title { font-size: 24px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#detail { color: var(--muted); }
#result.ok { background: var(--ok-bg); } #result.ok #state { color: var(--ok); }
#result.warn { background: var(--warn-bg); } #result.warn #state { color: var(--warn); }
#result.ok #state::before { content: ""; width: 8px; height: 15px; margin: -4px 4px 0 5px; border: solid; border-width: 0 4px 4px 0; transform: rotate(45deg); }

ol, ul { list-style: none; padding: 0 16px; }
#recent { flex: 1; overflow: auto; }
li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
li small { display: block; font-size: 14px; color: var(--muted); }

#list { overflow: auto; padding: 4px 16px 32px; gap: 28px; }
#list ul { padding: 0; }
dl div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--rule); }
dd { font-weight: 700; }
.actions { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
section > p { color: var(--muted); margin: 4px 0 8px; }
#result > p { margin: 0; }
textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid #8a8d91; border-radius: 8px; }

nav { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
nav button { border-radius: 0; background: none; color: var(--muted); font-weight: 400; min-height: 56px; }
nav [aria-current] { color: var(--text); font-weight: 700; }
