:root {
  color-scheme: light;
  font-family: "Avenir Next", "Apple SD Gothic Neo", sans-serif;
  color: #1e2723;
  background: #e9e7df;
  font-synthesis: none;
  --ink: #1e2723;
  --paper: #f8f6ef;
  --line: rgba(30, 39, 35, 0.16);
  --muted: #68716c;
  --signal: #e2522c;
  --signal-dark: #b43b1d;
  --ready: #18735f;
  --danger: #9a2929;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(30, 39, 35, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 39, 35, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 85% 5%, rgba(226, 82, 44, 0.12), transparent 28rem),
    #e9e7df;
  background-size: 28px 28px, 28px 28px, auto, auto;
}

button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-decoration: none; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--ink); color: var(--paper); font-family: Georgia, serif; font-size: 1rem; }
nav { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
nav > a { padding: 8px; color: var(--muted); font-size: .82rem; font-weight: 700; text-decoration: none; }

.button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: .82rem; font-weight: 800; }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { border-color: var(--ink); background: var(--ink); color: white; }
.button.secondary { background: var(--paper); color: var(--ink); }
.button.danger { border-color: rgba(154, 41, 41, .35); background: #fff4f2; color: var(--danger); }

main { padding: clamp(70px, 13vh, 150px) 0 80px; }
.overview { max-width: 930px; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .04em; }
.status-dot { width: 10px; height: 10px; border: 2px solid #9aa09d; border-radius: 50%; }
.status-dot.ready { border-color: var(--ready); background: var(--ready); box-shadow: 0 0 0 5px rgba(24, 115, 95, .12); }
.status-dot.error { border-color: var(--danger); background: var(--danger); }
h1 { margin: 22px 0 16px; overflow-wrap: anywhere; font-family: Georgia, "Nanum Myeongjo", serif; font-size: clamp(2.2rem, 6vw, 5.4rem); font-weight: 500; line-height: 1.02; letter-spacing: -.055em; }
.overview > p { margin: 0; color: var(--signal-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }

.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: clamp(65px, 12vh, 120px); border: 1px solid var(--ink); background: var(--paper); }
.quick-grid a { min-height: 145px; padding: 22px; border-right: 1px solid var(--ink); color: var(--ink); text-decoration: none; transition: background 160ms ease, color 160ms ease; }
.quick-grid a:last-child { border-right: 0; }
.quick-grid a:hover { background: var(--ink); color: var(--paper); }
.quick-grid span { display: block; margin-bottom: 32px; color: var(--signal); font-family: Georgia, serif; font-style: italic; }
.quick-grid strong, .quick-grid small { display: block; }
.quick-grid strong { font-size: 1rem; }
.quick-grid small { margin-top: 7px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.quick-grid a:hover small { color: rgba(255, 255, 255, .65); }

[hidden] { display: none !important; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(18, 24, 21, .62); backdrop-filter: blur(8px); }
.modal-panel { width: min(800px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border: 1px solid var(--ink); background: var(--paper); box-shadow: 0 24px 70px rgba(0, 0, 0, .22); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: rgba(248, 246, 239, .96); }
.modal-header h2 { margin: 3px 0 0; font-size: 1.25rem; }
.modal-kicker { color: var(--signal-dark); font-size: .66rem; font-weight: 900; letter-spacing: .14em; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 7px; background: transparent; cursor: pointer; font-weight: 900; }

.state-grid { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; }
.state-grid > div { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.state-grid > div:nth-child(even) { border-right: 0; }
.state-grid > .wide { grid-column: 1 / -1; border-right: 0; }
.state-grid dt { margin-bottom: 8px; color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.state-grid dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; font-weight: 700; }
.state-grid pre { max-height: 150px; margin: 0; overflow: auto; white-space: pre-wrap; }
.updated-at { margin: 0; padding: 13px 22px; color: var(--muted); font-size: .72rem; }

.goal-panel { width: min(900px, 100%); }
.goal-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 22px; }
label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 800; }
input { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); }
.action-row, .manual-row { display: flex; align-items: end; gap: 8px; padding: 0 22px 18px; }
.action-row { justify-content: flex-end; }
.manual-row { padding-top: 18px; border-top: 1px solid var(--line); }
.manual-row label { width: 150px; margin-right: auto; }
.warning { margin: 0 22px 14px; color: var(--danger); font-size: .75rem; font-weight: 700; }
.result-box { min-height: 94px; max-height: 220px; margin: 0; overflow: auto; padding: 16px 22px; border-top: 1px solid var(--line); background: #202723; color: #e9f2ec; white-space: pre-wrap; font-size: .72rem; line-height: 1.55; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { align-items: flex-start; padding: 14px 0; }
  .brand > span:last-child, nav > a { display: none; }
  nav { flex-wrap: wrap; }
  main { padding-top: 70px; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-grid a { min-height: 112px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .quick-grid a:last-child { border-bottom: 0; }
  .quick-grid span { margin-bottom: 18px; }
  .goal-fields { grid-template-columns: repeat(2, 1fr); }
  .manual-row { flex-wrap: wrap; }
  .manual-row label { width: 100%; }
}

@media (max-width: 480px) {
  .button { padding: 0 10px; font-size: .75rem; }
  .state-grid, .goal-fields { grid-template-columns: 1fr; }
  .state-grid > div { border-right: 0; }
  .state-grid > .wide { grid-column: auto; }
  .action-row { flex-wrap: wrap; }
  .action-row .button { flex: 1 1 120px; }
  .manual-row .button { flex: 1 1 calc(50% - 8px); }
}
