/* Lived by Leah. Palette: Golden Pollen, Mustard, Frosted Blue, Blue Grey, Porcelain. */
:root {
  --pollen: #FDC921;
  --mustard: #FDD85D;
  --frost: #99D6EA;
  --bluegrey: #6798C0;
  --porcelain: #FFFDF7;
  --ink: #1E3248;
  --muted: #4F6277;
  --line: #E4DAB4;
  --danger: #B3261E;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--porcelain); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 6vw, 44px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 600; }
p { margin: 0 0 12px; max-width: 65ch; }
a { color: #2F6590; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--bluegrey); outline-offset: 2px; }

/* Layout: fixed left sidebar, content column on the right. */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--frost); padding: 28px 20px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  border-right: 4px solid var(--pollen);
}
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; line-height: 1; }
.brand-top { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 54px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sidebar li a {
  display: block; padding: 12px 14px; border-radius: 8px; text-decoration: none;
  color: var(--ink); font-weight: 700;
}
.sidebar li a:hover { background: var(--mustard); }
.sidebar li a.active { background: var(--pollen); }
.admin-link { margin-top: auto; font-size: 14px; color: var(--ink); }
.content { padding: 40px max(24px, 4vw) 64px; max-width: 980px; width: 100%; }
.lede { color: var(--muted); font-size: 18px; margin-bottom: 28px; }
.empty, .soon { background: #FFF6D6; border: 1px solid var(--line); border-radius: 8px; padding: 16px; max-width: 65ch; }
.menu-btn { display: none; }

/* Writing posts */
.post { border-top: 1px solid var(--line); padding: 24px 0; max-width: 68ch; }
.post time { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.post h2 { margin-top: 4px; }
.post-vlog { font-weight: 700; }

/* Vlog grid */
.vlog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 20px; }
.vlog { min-width: 0; }
.vlog h2 { font-size: 16px; margin: 10px 0 4px; font-family: var(--font-body); font-weight: 700; line-height: 1.35; }
.vlog-links { display: flex; gap: 14px; font-size: 14px; margin: 0; }
.vlog-thumb {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  aspect-ratio: 9 / 16; overflow: hidden; border-radius: 10px; background: var(--ink);
}
.vlog-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vlog-thumb .play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%;
  background: var(--pollen); box-shadow: 0 2px 0 rgba(30,50,72,.35);
}
.vlog-thumb .play::after {
  content: ""; position: absolute; left: 25px; top: 18px;
  border-left: 22px solid var(--ink); border-top: 14px solid transparent; border-bottom: 14px solid transparent;
}
.vlog iframe { width: 100%; aspect-ratio: 9 / 16; border: 0; border-radius: 10px; display: block; }

/* Buttons and forms */
.btn {
  display: inline-block; background: var(--pollen); color: var(--ink); font: inherit; font-weight: 700;
  border: 2px solid var(--ink); border-radius: 8px; padding: 10px 18px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--mustard); }
.btn.ghost { background: transparent; }
.form { display: grid; gap: 8px; max-width: 560px; margin-bottom: 32px; }
.form label { font-weight: 700; font-size: 14px; margin-top: 6px; }
input, textarea, select {
  font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--bluegrey);
  border-radius: 8px; padding: 10px 12px; width: 100%;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.notice { background: #E6F5EA; border: 1px solid #9AD3AA; padding: 10px 14px; border-radius: 8px; max-width: 65ch; }
.error { background: #FCE8E6; border: 1px solid #E6A19B; color: var(--danger); padding: 10px 14px; border-radius: 8px; max-width: 65ch; }

/* Admin */
body.admin { background: var(--porcelain); }
.admin-bar {
  display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between;
  padding: 14px max(16px, 3vw); background: var(--frost); border-bottom: 4px solid var(--pollen);
}
.admin-bar nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.admin-bar a { color: var(--ink); font-weight: 700; }
.admin-main { padding: 28px max(16px, 3vw) 64px; max-width: 900px; }
.admin-main.narrow { max-width: 460px; margin: 0 auto; }
.cards { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.card { display: grid; gap: 2px; background: #FFF6D6; border: 1px solid var(--line); border-radius: 10px; padding: 16px 22px; text-decoration: none; color: var(--ink); min-width: 150px; }
.card strong { font-family: var(--font-display); font-size: 36px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; min-width: 360px; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #FFF6D6; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
.link-danger { background: none; border: 0; color: var(--danger); font: inherit; font-weight: 700; cursor: pointer; padding: 0 0 0 12px; text-decoration: underline; }

/* Game */
.game { position: relative; max-width: 640px; border: 4px solid var(--ink); border-radius: 6px; background: #9BDBF0; }
.game canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; touch-action: none; }
.game-hud {
  position: absolute; z-index: 2; left: 8px; top: 8px; display: flex; gap: 10px;
  font-family: var(--font-pixel); font-size: 10px; color: var(--ink);
}
.game-hud span { background: var(--porcelain); border: 2px solid var(--ink); padding: 5px 7px; }
.game-overlay {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; background: rgba(255, 253, 247, .93); padding: 16px;
}
.game-overlay[hidden] { display: none; }
.game-overlay p { margin: 0; }
.game-overlay input { max-width: 260px; }
.game-overlay label { font-size: 13px; font-weight: 700; }
.pixel { font-family: var(--font-pixel); font-size: 18px; line-height: 1.5; }
.hint { color: var(--muted); font-size: 14px; }
.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: flex; gap: 8px; justify-content: space-between; padding: 8px; background: var(--frost); border-top: 4px solid var(--ink); }
  .touch button {
    flex: 1; min-height: 52px; font-family: var(--font-pixel); font-size: 11px; background: var(--pollen);
    border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none;
  }
}

/* Phone: sidebar becomes a slide-down menu. */
@media (max-width: 760px) {
  .shell { display: block; }
  .menu-btn {
    display: block; position: fixed; z-index: 20; top: 10px; right: 10px;
    background: var(--pollen); border: 2px solid var(--ink); border-radius: 8px; padding: 8px 14px;
    font: inherit; font-weight: 700; color: var(--ink);
  }
  .sidebar {
    display: none; position: fixed; z-index: 15; inset: 0; height: auto; padding-top: 64px;
    border-right: 0; overflow-y: auto;
  }
  body.menu-open .sidebar { display: flex; }
  .content { padding: 64px 16px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
