:root {
  --ink: #111111;
  --muted: #666666;
  --faint: #8a8680;
  --line: #e5e2dc;
  --paper: #ffffff;
  --tile: #f2f0ec;
  --danger: #a32d2d;
  --pad: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Gowun Batang', serif;
  -webkit-text-size-adjust: 100%;
}

body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

#app { max-width: 560px; margin: 0 auto; padding-bottom: 48px; }

a { color: var(--ink); text-decoration: none; }

button { font: inherit; color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--pad) 0;
  min-height: 56px;
  font-size: 14px;
}
.top a, .top button { min-height: 44px; display: inline-flex; align-items: center; }

.logo { font-size: 13px; letter-spacing: 3px; }
.plus { font-size: 28px; line-height: 1; padding-left: 16px; }

.big { margin: 0; font-size: 38px; font-weight: 400; line-height: 1.1; }
.pad { padding: 0 var(--pad); }
.muted { color: var(--muted); }

.link {
  border: none;
  background: none;
  padding: 0;
  min-height: 44px;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.link.danger { color: var(--danger); }
.link[aria-busy="true"] { color: var(--faint); text-decoration: none; }

.solid {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
}

/* 목록 */
.month { padding: 24px var(--pad) 12px; }
.meta { padding: 6px 0 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--ink); }
.grid { padding-top: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; align-items: start; }
.card { display: flex; flex-direction: column; gap: 8px; }
.card img { width: 100%; height: auto; display: block; background: var(--tile); min-height: 120px; }
.cap { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.cap .muted { text-align: right; }

.empty { padding: 72px var(--pad); display: flex; flex-direction: column; gap: 16px; }
.empty p { margin: 0 0 16px; color: var(--muted); line-height: 1.7; }

.foot { padding: 40px var(--pad) 0; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.foot .link { font-size: 13px; color: var(--muted); }

/* 상세 */
.hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px var(--pad) 0; }
.press {
  position: relative;
  width: fit-content;
  max-width: min(72vw, 300px);
  background: var(--tile);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
.press img { display: block; max-width: 100%; max-height: 58vh; width: auto; height: auto; pointer-events: none; }
.press video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--ink);
  pointer-events: none;
  visibility: hidden;
}
.press.playing video { visibility: visible; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }

.title { padding: 28px var(--pad) 0; }
.memo { margin: 14px 0 0; font-size: 15px; line-height: 1.7; white-space: pre-line; }

.rows { margin: 22px var(--pad) 0; border-top: 1px solid var(--ink); font-size: 14px; }
.rows div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; text-align: right; }

.actions { display: flex; gap: 24px; padding: 16px var(--pad) 0; }
.danger-zone { padding: 40px var(--pad) 0; }

/* 등록 */
.pickers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 24px var(--pad) 0; }
.pick {
  position: relative;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}
.pick.photo { background: var(--tile); }
.pick.video { border: 1px solid var(--ink); }
.pick > span:first-child { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.pick img { max-width: 100%; max-height: 140px; display: block; }
.pick .plus-sign { font-size: 26px; line-height: 1; }
.pick .sub { font-size: 12px; color: var(--muted); word-break: break-all; }
.pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.pick-tools { display: flex; justify-content: flex-end; padding: 0 var(--pad); }

.fields { display: flex; flex-direction: column; gap: 22px; padding: 20px var(--pad) 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .field .lbl { font-size: 12px; color: var(--muted); }
.field input {
  height: 44px;
  border: none;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 0;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.field input::placeholder { color: #9a958e; }
.field input:focus { outline: none; border-bottom-width: 2px; }

.brands { display: flex; flex-wrap: wrap; column-gap: 18px; }
.brands button {
  border: none;
  background: none;
  padding: 0;
  min-height: 44px;
  font-size: 15px;
  color: var(--faint);
  cursor: pointer;
}
.brands button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

.err { margin: 0; padding: 0 var(--pad); min-height: 20px; font-size: 13px; color: var(--danger); }
.progress { padding: 16px var(--pad) 0; font-size: 13px; color: var(--muted); margin: 0; }

/* 로그인 */
.login { min-height: 90vh; display: flex; flex-direction: column; justify-content: center; padding: 0 32px; }
.login h1 { margin: 14px 0 56px; font-size: 40px; font-weight: 400; line-height: 1.2; }
.login form { display: flex; flex-direction: column; gap: 22px; }
.login .err { padding: 0; }

.loading { padding: 80px var(--pad); color: var(--muted); font-size: 14px; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: calc(100% - 48px);
}
#toast.show { opacity: 1; }
