:root {
  --bg: #14110f;
  --bg-soft: #1d1814;
  --panel: #211b16;
  --panel-strong: #2a211a;
  --line: rgba(255, 232, 204, 0.12);
  --text: #fff6ea;
  --muted: #baa995;
  --faint: #7e7163;
  --accent: #e7a64a;
  --green: #57d68d;
  --red: #ff6b6b;
  --blue: #83a8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 24px;
  font-family: "Inter", "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(231, 166, 74, 0.18), transparent 32rem),
    radial-gradient(circle at 85% 8%, rgba(131, 168, 255, 0.10), transparent 28rem),
    var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #17110b;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(42, 33, 26, 0.92), rgba(29, 24, 20, 0.88));
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.4rem, 6vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: -0.085em;
}

.hero-copy {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button,
.filter {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-card strong {
  font-size: 1.8rem;
  letter-spacing: -0.05em;
}

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.left-panel {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.panel,
.library-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(33, 27, 22, 0.86);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2);
}

.panel { padding: 20px; }
.panel-head,
.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.panel-head h2,
.library-toolbar h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.055em;
}

.search-box {
  display: flex;
  gap: 8px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  outline: none;
}
input, select { min-height: 44px; padding: 0 13px; }
textarea { min-height: 104px; padding: 13px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(231, 166, 74, 0.48);
  box-shadow: 0 0 0 4px rgba(231, 166, 74, 0.12);
}
.search-box button,
.manual-form button,
.review-form button[type="submit"] {
  min-height: 44px;
  padding: 0 18px;
}

.manual-form { display: grid; gap: 10px; }
.search-results { display: grid; gap: 10px; margin-top: 14px; }

.search-result {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}
.search-result img,
.result-cover-placeholder {
  width: 54px;
  height: 78px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--panel-strong);
}
.search-result h3 { margin: 0; font-size: 0.98rem; line-height: 1.25; }
.search-result p { margin: 5px 0 10px; color: var(--muted); font-size: 0.82rem; }
.search-result button { min-height: 34px; padding: 0 12px; font-size: 0.82rem; }

.library-panel { padding: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.filter {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}
.filter.is-active {
  background: var(--text);
  color: var(--bg);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.book-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  cursor: pointer;
}
.book-cover {
  aspect-ratio: 2 / 3;
  background:
    linear-gradient(145deg, rgba(231, 166, 74, 0.22), rgba(131, 168, 255, 0.12)),
    var(--panel-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -0.08em;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-body { padding: 14px; display: flex; flex: 1; flex-direction: column; }
.book-body h3 { margin: 0 0 5px; line-height: 1.25; letter-spacing: -0.04em; }
.book-meta { margin: 0 0 10px; color: var(--muted); font-size: 0.84rem; }
.book-one-line {
  margin: 0 0 12px;
  color: #e6d5c1;
  font-size: 0.88rem;
  line-height: 1.5;
}
.book-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}
.status-pill {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status-reading { color: var(--blue); }
.status-finished { color: var(--green); }
.status-paused { color: var(--red); }
.stars { color: var(--accent); font-size: 0.86rem; white-space: nowrap; }
.empty-state {
  padding: 48px 20px;
  border: 1px dashed var(--line);
  border-radius: 24px;
  text-align: center;
  color: var(--muted);
}

.review-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(10px);
}
.drawer-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(760px, calc(100vw - 32px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #18130f;
  box-shadow: var(--shadow);
}
.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 1.6rem;
}
.drawer-book {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 18px;
  padding-right: 48px;
  margin-bottom: 22px;
}
.drawer-cover {
  width: 108px;
  aspect-ratio: 2 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel-strong);
}
.drawer-cover img { width: 100%; height: 100%; object-fit: cover; }
.drawer-book h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.075em;
}
.review-form {
  display: grid;
  gap: 14px;
}
.review-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.main-review { min-height: 220px; }
.drawer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 8px;
}
.danger-button {
  margin-right: auto;
  background: rgba(255, 107, 107, 0.12);
  color: var(--red);
}
.save-status { color: var(--muted); font-size: 0.82rem; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 20%, rgba(231, 166, 74, 0.16), transparent 28rem),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0; font-size: 3rem; letter-spacing: -0.08em; }
.login-form { display: grid; gap: 10px; margin-top: 20px; }
.login-form button { min-height: 46px; }
.form-error { min-height: 20px; color: var(--red); }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .left-panel { position: static; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .app-shell { width: min(100vw - 20px, 1440px); padding-top: 10px; }
  .hero, .library-panel, .panel { border-radius: 22px; padding: 18px; }
  .hero { flex-direction: column; }
  .hero h1 { font-size: 2.6rem; }
  .stats-grid, .form-row { grid-template-columns: 1fr; }
  .library-toolbar { flex-direction: column; }
  .filters { justify-content: flex-start; }
  .drawer-panel { inset: 8px; width: auto; padding: 18px; border-radius: 22px; }
  .drawer-book { grid-template-columns: 78px 1fr; gap: 14px; }
  .drawer-cover { width: 78px; }
}
