/* Odd Neighbours: UI mock-ups. Plain CSS, no JavaScript, no game logic. */

:root {
  --wall: #f7ead6;
  --paper: #fffaf0;
  --ink: #2b2130;
  --muted: #6b5d70;
  --accent: #e2683c;
  --mush: #d2443a;
  --rain: #3f7fb6;
  --night: #2b2130;
  --line: #e2cfb3;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--wall);
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  padding: 10px 16px; background: var(--night); color: #fff;
}
.topbar a { color: #fff; }
.topbar .here { font-weight: 700; flex: 1 1 auto; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: .75rem; background: #fff2; border: 1px solid #fff5;
}

/* ---------- layout of screens ---------- */
.screens { display: flex; flex-direction: column; gap: 24px; padding: 0 0 32px; }
.slot-label { margin: 16px 16px 6px; font-size: .85rem; color: var(--muted); }
.screen { background: var(--paper); padding: 14px; }
.screen h2 { margin: 0 0 8px; font-size: 1.1rem; }
.screen p { margin: 0 0 10px; }

/* the phone frame appears only on wide screens; narrow screens get the plain page */
@media (min-width: 600px) {
  body { background: var(--night); }
  .screens { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 28px; padding: 24px; }
  .slot { width: 390px; }
  .slot-label { margin: 0 0 8px; color: #e9dcef; }
  .screen { width: 390px; border-radius: 36px; padding: 22px 16px; box-shadow: 0 10px 30px #0006; }
}

/* ---------- state switching (:target, no JavaScript) ----------
   The default state is the LAST .state in its container. */
.state { display: none; }
.state.default, .state:target { display: block; }
.state:target ~ .state.default { display: none; }

.switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.switch a, .btn {
  display: inline-block; padding: 8px 12px; border-radius: 999px;
  background: #fff; border: 2px solid var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.note { font-size: .8rem; color: var(--muted); }

/* ---------- art ---------- */
svg.art { display: block; width: 100%; height: auto; }
.ico { width: 28px; height: 28px; flex: none; }

/* ---------- direction A: Home window ---------- */
.home {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: auto minmax(60%, 1fr) auto;
  gap: 6px;
  background: var(--ink);
  border-radius: var(--radius);
  padding: 6px;
}
.room { grid-area: 2 / 2; min-width: 0; border-radius: 8px; overflow: hidden; }
.edge { min-width: 0; overflow-wrap: anywhere; text-decoration: none; color: #fff; font-size: .78rem; line-height: 1.2; }
.edge.up { grid-area: 1 / 1 / 2 / 4; }
.edge.left { grid-area: 2 / 1; }
.edge.right { grid-area: 2 / 3; }
.edge.down { grid-area: 3 / 1 / 4 / 4; }
.edge.left, .edge.right {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  max-width: 76px; padding: 6px 4px; text-align: center; background: #ffffff14; border-radius: 8px;
}
.edge.down { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #ffffff14; border-radius: 8px; }
.edge small { color: #d9cde0; font-size: .7rem; }
/* side and lower neighbours: light chips so dark icons (the bats) stay visible */
.edge.left, .edge.right, .edge.down { background: var(--wall); color: var(--ink); }
.edge.left small, .edge.right small { color: var(--muted); }
.edge.left, .edge.right { max-width: 72px; font-size: .72rem; }
/* the neighbour who caused the change gets real space */
.edge.cause { position: relative; border-radius: 8px; overflow: hidden; }
.edge.cause .art { width: 100%; aspect-ratio: 390 / 150; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .75rem; font-weight: 600;
}
.edge.cause .chip { position: absolute; left: 8px; top: 8px; }
.room .chip { margin: 6px; position: absolute; }
.room { position: relative; }

.caption { margin: 10px 2px 0; font-size: .95rem; }

/* ---------- feed card (test sizes, not Reddit's limits) ---------- */
.post-head { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.post-title { font-weight: 700; margin: 0 0 8px; }
.feed-frame {
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
  border: 2px dashed #b9a48a; border-radius: 12px; padding: 8px; background: var(--wall);
}
.feed-frame.h340 { height: 340px; }
.feed-frame.h520 { height: 520px; }
.feed-frame .grow { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.feed-frame .size { font-size: .7rem; color: var(--muted); margin: 0; }

/* ---------- move in ---------- */
.choices { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choices a {
  display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; text-decoration: none;
}
.choices a.picked { border-color: var(--accent); background: #fff1e8; }

/* ---------- direction B: Comic reveal ---------- */
.comic { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.panel { border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; background: #fff; position: relative; }
.panel .caption { margin: 0; padding: 6px 10px; font-size: .9rem; border-top: 2px solid var(--ink); }
.panel .chip { position: absolute; left: 8px; top: 8px; }

/* ---------- direction C: Lobby stories ---------- */
.stories { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.story { background: #fff; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.story .pic { position: relative; background: var(--ink); padding: 4px; display: grid; gap: 4px; }
.story .pic .chip { position: absolute; left: 10px; top: 10px; }
.story .text { padding: 8px 10px; }
.story h3 { margin: 0 0 4px; font-size: 1rem; }
.story.small { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.story.small h3 { font-size: .92rem; margin: 0; }

/* ---------- neighbour list ---------- */
.neighbours { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.neighbours li { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line); overflow-wrap: anywhere; min-width: 0; }
.neighbours li div { min-width: 0; }
.neighbours li:target { border: 2px solid var(--accent); }

/* ---------- respond and history (stages 3 and 4) ---------- */
.sheet { background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 12px; }
.sheet fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 8px 10px; }
.sheet legend { font-weight: 700; padding: 0 4px; }
.sheet label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; overflow-wrap: anywhere; }
.sheet textarea { width: 100%; min-height: 70px; font: inherit; border-radius: 8px; border: 1px solid #b9a48a; padding: 6px; }
.history-strip { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: #eaf3e6; border: 1px solid #b7d1ac; font-size: .9rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 3px solid var(--line); }
.timeline li { margin: 0 0 8px; position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }

/* ---------- building overview ---------- */
.tower { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--ink); padding: 6px; border-radius: 12px; }
.floor-label { grid-column: 1 / -1; color: #e9dcef; font-size: .75rem; margin: 4px 2px 0; }
.cell {
  background: var(--wall); border-radius: 8px; padding: 6px; min-height: 84px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-size: .72rem; line-height: 1.2; overflow-wrap: anywhere; text-decoration: none;
}
.cell.you { outline: 3px solid var(--accent); background: #fff1e8; font-weight: 700; }
.cell.new { background: #eaf3e6; }
.cell.vacant { background: #e6dfd6; color: var(--muted); }

/* ---------- index ---------- */
.page { max-width: 980px; margin: 0 auto; padding: 16px; }
@media (min-width: 600px) { .page { background: var(--paper); border-radius: 20px; margin: 24px auto; padding: 24px 28px; } }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 12px 0 18px; }
.card { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px; }
.card h3 { margin: 0 0 6px; }
.card ul { margin: 6px 0 0; padding-left: 18px; }
table { border-collapse: collapse; width: 100%; margin: 8px 0 18px; font-size: .92rem; }
th, td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
th { background: #fff1e8; }
.table-wrap { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.comic.row { flex-direction: row; }
.comic.row .panel { flex: 1 1 0; min-width: 0; }
.spaced { margin-top: 10px; }
