/* Shared design system: tokens, shell and components for the landing page, Pack Player and Memory Board. CSS only. */

/* ---- Tokens ---- */
:root {
  /* Bone palette */
  --bone: #f4efe3;
  --bone-light: #fbf9f3;
  --bone-dark: #d3ccba;
  --ink: #1c1a16;
  --ink-soft: #46423a;
  --accent: #1f4e79;
  --accent-dark: #153a5c;
  --accent-tint: #e6eef6;
  --link: #1f4e79;
  --focus: #9a7200;
  --danger: #7a1c14;
  --danger-tint: #fdecea;
  --success: #14501f;
  --success-tint: #e6f4ea;
  --playing-bg: #fff6d1;
  --playing-ink: #1a1500;
  --playing-edge: #8a6a00;

  /* Type scale */
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, Consolas, "SFMono-Regular", monospace;
  --fs-title: 1.9rem;
  --fs-heading: 1.35rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;

  /* Spacing steps */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2.25rem;
  --s7: 3.5rem;

  /* Radius and shadow levels */
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(38, 36, 31, 0.08);
  --shadow-2: 0 1px 2px rgba(38, 36, 31, 0.08), 0 4px 14px rgba(38, 36, 31, 0.08);
  --shadow-3: 0 2px 4px rgba(38, 36, 31, 0.1), 0 10px 28px rgba(38, 36, 31, 0.14);

  /* Content column */
  --col: 44rem;
}
body.wide { --col: 60rem; }

/* ---- Base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bone);
  overflow-wrap: anywhere;
}
a { color: var(--link); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: var(--fs-heading); margin: var(--s5) 0 var(--s3); letter-spacing: -0.005em; }
h3 { font-size: 1.05rem; margin: var(--s5) 0 var(--s2); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- Shell: top bar, title area, content column ---- */
.shell { width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 var(--s5); }
.topbar { background: var(--bone-light); border-bottom: 1px solid var(--bone-dark); }
.topbar .shell { display: flex; align-items: center; min-height: 3.25rem; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 2.75rem;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}
.brand::before { content: "\2620\FE0E"; font-size: 1.1rem; }
.brand:hover { text-decoration: underline; }
.page-title { padding-top: var(--s6); padding-bottom: var(--s4); position: relative; }
.page-title h1 { font-size: var(--fs-title); letter-spacing: -0.01em; margin: 0; }
.page-title .lede { margin: var(--s2) 0 0; color: var(--ink-soft); }
/* Bone divider under the title, drawn with an inline SVG data URI. */
.page-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 24px;
  margin-top: var(--s4);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='24' viewBox='0 0 64 24'%3E%3Cg fill='%23d3ccba'%3E%3Ccircle cx='6' cy='6' r='4'/%3E%3Ccircle cx='6' cy='18' r='4'/%3E%3Ccircle cx='58' cy='6' r='4'/%3E%3Ccircle cx='58' cy='18' r='4'/%3E%3Crect x='6' y='8' width='52' height='8' rx='4'/%3E%3C/g%3E%3C/svg%3E") no-repeat left center / contain;
}
.content { padding-bottom: var(--s7); }
.site-footer { border-top: 1px solid var(--bone-dark); color: var(--ink-soft); font-size: var(--fs-small); }
.site-footer .shell { padding-top: var(--s4); padding-bottom: var(--s6); }
.site-footer a { display: inline-flex; align-items: center; min-height: 2.75rem; }

/* ---- Buttons: quiet (default), primary, danger ---- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  font: inherit;
  font-weight: 600;
  min-height: 2.75rem;
  padding: var(--s2) var(--s4);
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--ink-soft);
  border-radius: var(--radius);
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--bone-dark); }
.btn-primary,
.empty-state button,
.entry-open {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover,
.empty-state button:hover,
.entry-open:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger,
.entry-delete { color: var(--danger); border-color: #c9a39e; background: #fff; }
.btn-danger:hover,
.entry-delete:hover { background: var(--danger-tint); }
select {
  font: inherit;
  min-height: 2.75rem;
  padding: var(--s1) var(--s3);
  border-radius: var(--radius);
  border: 1.5px solid var(--ink-soft);
  background: #fff;
}
label { font-weight: 600; color: var(--ink-soft); }

/* ---- Notice, empty state, entry list ---- */
.notice { padding: var(--s3) var(--s4); border-radius: var(--radius); margin: 0 0 var(--s4); border-left: 6px solid; }
.notice p { margin: var(--s1) 0; }
.notice-success { background: var(--success-tint); color: var(--success); border-color: var(--success); }
.notice-error { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.empty-state { border: 2px dashed var(--bone-dark); border-radius: var(--radius); padding: var(--s5); margin: var(--s4) 0; background: var(--bone-light); }
.empty-state p { margin: 0 0 var(--s3); }
.entry-list { list-style: none; padding: 0; margin: 0; }
.entry-list li { display: flex; gap: var(--s3); margin: var(--s3) 0; }
.entry-open { flex: 1; min-width: 0; justify-content: flex-start; text-align: left; font-size: 1.05rem; box-shadow: var(--shadow-2); }
.entry-count { font-weight: 400; opacity: 0.85; white-space: pre; }

/* ---- Memo export panel ---- */
.memo-panel { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--bone-dark); }
textarea { display: block; width: 100%; min-height: 9rem; margin: var(--s3) 0 var(--s2); padding: var(--s3); font-family: var(--mono); font-size: 0.95rem; border: 1.5px solid var(--bone-dark); border-radius: var(--radius); background: #fff; }

/* ---- Cards and chips (shared components) ---- */
.card { background: #fff; border: 1px solid var(--bone-dark); border-radius: var(--radius-lg); padding: var(--s4) var(--s5); box-shadow: var(--shadow-2); }
.chip { display: inline-flex; align-items: center; font-size: var(--fs-small); font-weight: 600; color: var(--accent); background: var(--accent-tint); border-radius: 999px; padding: var(--s1) var(--s3); }

/* ---- Playable rows and blocks, with the current-item highlight ---- */
.playable {
  display: block;
  width: 100%;
  text-align: left;
  font-weight: 500;
  background: #fff;
  border: 1.5px solid var(--bone-dark);
  border-left: 8px solid var(--bone-dark);
  box-shadow: var(--shadow-1);
}
.playable:hover { background: var(--bone-light); border-color: var(--ink-soft); }
.playable.playing {
  background: var(--playing-bg);
  color: var(--playing-ink);
  border-color: var(--playing-edge);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(154, 114, 0, 0.4), var(--shadow-3);
}
@media (prefers-reduced-motion: no-preference) {
  button, .btn, .playable { transition: background 0.12s, border-color 0.12s, box-shadow 0.15s, transform 0.15s; }
  .playable.playing { transform: scale(1.01); }
}

/* ---- Playback bar ---- */
.playbar {
  position: sticky;
  top: var(--s2);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin: var(--s3) 0 var(--s4);
  padding: var(--s3);
  background: var(--bone-light);
  border: 1px solid var(--bone-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}
.playbar label { display: inline-flex; align-items: center; gap: var(--s2); margin-left: auto; }

@media (max-width: 30rem) {
  :root { --fs-title: 1.6rem; --fs-body: 1rem; }
  .shell { padding: 0 var(--s4); }
  .page-title { padding-top: var(--s5); }
  .entry-list li { flex-wrap: wrap; }
  .entry-open { flex-basis: 100%; }
  .entry-delete { flex: 1; }
  .card { padding: var(--s4); }
  .playbar { gap: var(--s2); padding: var(--s2); }
}
