/* Known World website. Warm and plain: cream surfaces, dark ink, one terracotta accent. */

:root {
  --bg: #f6efe4;
  --card: #fffaf2;
  --ink: #2a211b;
  --muted: #7b6a5b;
  --faint: #a8998a;
  --line: #e6dac8;
  --line-strong: #d6c6af;
  --accent: #b5532f;
  --accent-ink: #fff8ef;
  --good: #4f7a3c;
  --shadow: 0 1px 2px rgba(42, 33, 27, 0.06), 0 8px 24px rgba(42, 33, 27, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #8fae6a;
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

#world {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: grab;
}

#world.dragging {
  cursor: grabbing;
}

#world.pointing {
  cursor: pointer;
}

button {
  font: inherit;
  color: inherit;
}

/* ------------------------------------------------------------ top bar */

.bar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.brand {
  font: 600 15px var(--serif);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.search {
  position: relative;
  margin-left: 12px;
  width: min(340px, 34vw);
}

.search svg {
  position: absolute;
  left: 10px;
  top: 9px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.search input:focus {
  border-color: var(--line-strong);
  background: #fff;
}

.results {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.results button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.results button:hover,
.results button.sel {
  background: var(--bg);
}

.results .sub {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.spacer {
  flex: 1;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}

.seg button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

.seg button.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(42, 33, 27, 0.12);
}

.btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn.ghost {
  background: var(--card);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ------------------------------------------------------------ side panel */

.panel {
  position: fixed;
  top: 72px;
  right: 12px;
  bottom: 12px;
  width: 360px;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 9;
}

.panel .close {
  position: sticky;
  float: right;
  top: 10px;
  margin: 10px 10px 0 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  z-index: 2;
}

.panel .close svg {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.panel-head {
  padding: 20px 20px 4px;
}

.kicker {
  font: 600 11px var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel h2 {
  margin: 4px 0 2px;
  font: 600 24px/1.15 var(--serif);
}

.panel .lead {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 20px 6px;
}

.stat {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.stat b {
  display: block;
  font: 600 19px var(--serif);
  font-variant-numeric: tabular-nums;
}

.stat span {
  color: var(--muted);
  font-size: 11.5px;
}

.section {
  padding: 12px 20px;
}

.section h3 {
  margin: 0 0 8px;
  font: 600 12px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.subject {
  display: grid;
  grid-template-columns: 1fr 120px 38px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}

.subject .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 6px;
  border-radius: 3px;
  background: #ece2d2;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.subject em {
  font-style: normal;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lanterns li {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.lanterns ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lanterns .when {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}

.dot-lantern {
  flex: none;
  width: 9px;
  height: 12px;
  margin-top: 4px;
  border-radius: 5px;
  background: #e0573c;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px 20px;
}

.choices {
  display: grid;
  gap: 6px;
  padding: 0 20px 16px;
}

.choices button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.choices button:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.muted {
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  padding: 10px 20px;
  font-size: 13px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ corners */

.corner-left {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 8;
}

#minimap {
  display: block;
  width: 220px;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.mm-caption {
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(42, 33, 27, 0.66);
  color: #fbf1e2;
  font-size: 12px;
  width: max-content;
  max-width: 220px;
}

.mm-caption:empty {
  display: none;
}

.corner-right {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 8;
}

.panel:not([hidden]) ~ .corner-right {
  right: 384px;
}

.hint {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(42, 33, 27, 0.62);
  color: #fbf1e2;
  font-size: 12px;
}

.zoom {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

.zoom button {
  width: 36px;
  height: 34px;
  border: 0;
  background: none;
  font-size: 18px;
  cursor: pointer;
}

.zoom button + button {
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------ small floating things */

.tip {
  position: fixed;
  z-index: 20;
  max-width: 280px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  pointer-events: none;
}

.tip b {
  display: block;
  font-size: 13px;
}

.tip .muted {
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 74px;
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  z-index: 30;
  font-weight: 500;
}

.online {
  position: fixed;
  top: 72px;
  left: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--muted);
  z-index: 8;
}

.online b {
  color: var(--good);
}

.dialog {
  max-width: 420px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(42, 33, 27, 0.35);
}

.dialog h2 {
  margin: 0 0 8px;
  font: 600 22px var(--serif);
}

.dialog ol {
  padding-left: 20px;
}

.dialog form {
  margin-top: 16px;
  text-align: right;
}

@media (max-width: 760px) {
  .brand {
    display: none;
  }
  .search {
    margin-left: 0;
    width: 100%;
  }
  .seg,
  .hint,
  #mine {
    display: none !important;
  }
  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    width: auto;
    height: 55vh;
  }
  .panel:not([hidden]) ~ .corner-right {
    right: 12px;
    display: none;
  }
  #minimap {
    width: 150px;
    height: 102px;
  }
}

.empty {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 440px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  z-index: 7;
}

.empty h2 {
  margin: 0 0 8px;
  font: 600 22px/1.2 var(--serif);
}

.empty p {
  margin: 8px 0 0;
}

/* ------------------------------------------------------------ v2: talking, friends, districts, customizing */

.nav {
  display: flex;
  gap: 2px;
  margin-left: 6px;
}

.navbtn {
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

.navbtn:hover,
.navbtn.on {
  background: var(--bg);
  color: var(--ink);
}

.talk {
  position: fixed;
  left: 244px;
  right: 64px;
  bottom: 12px;
  max-width: 620px;
  z-index: 8;
}

.panel:not([hidden]) ~ .talk {
  right: 436px;
}

.chatlog {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.chatlog li {
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
  animation: chat-in 0.25s ease-out;
  transition: opacity 0.6s;
}

.chatlog li.old {
  opacity: 0.55;
}

.chatlog li b {
  color: var(--accent);
  font-weight: 600;
  margin-right: 4px;
}

.chatlog li.mine b {
  color: var(--good);
}

@keyframes chat-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.talk-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.emotes {
  display: flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.emotes button {
  width: 32px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.emotes button:hover {
  background: var(--bg);
}

.emotes button:active {
  transform: scale(0.92);
}

.emotes svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat {
  flex: 1;
  display: flex;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.chat input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.chat input::placeholder {
  color: var(--faint);
}

.chat .btn {
  height: 30px;
  padding: 0 12px;
}

/* customizing */

.form {
  padding: 4px 20px 16px;
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 5px;
  font: 600 12px var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="date"] {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--line-strong);
  background: #fff;
}

.field .row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swatch {
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  background: none;
  display: grid;
  place-items: center;
}

.swatch i {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.swatch.on {
  border-color: var(--ink);
}

.swatch.theme i {
  background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%);
}

.icons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.icons button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.icons button canvas {
  display: block;
}

.icons button.on {
  border-color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.avatar-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
}

.avatar-row canvas {
  display: block;
  width: 64px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #e6ead8;
}

.stepper {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  margin-bottom: 4px;
}

.stepper div {
  display: flex;
  gap: 4px;
}

.stepper button {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  padding: 0;
}

.stepper i {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.hintline {
  color: var(--faint);
  font-size: 12px;
}

/* friends and districts */

.friend {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.friend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.friend .dot.on {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(79, 122, 60, 0.18);
}

.friend b {
  display: block;
  font-weight: 600;
}

.friend span {
  color: var(--muted);
  font-size: 12px;
}

.friend em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px 8px;
}

.tabs button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
}

.tabs button.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.board {
  padding: 0 20px;
}

.board .subject {
  grid-template-columns: 22px 1fr auto;
  cursor: pointer;
}

.board .rank {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.feed {
  list-style: none;
  margin: 0;
  padding: 0 20px 16px;
}

.feed li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.feed li b {
  font-weight: 600;
  cursor: pointer;
}

.feed .when {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.feed .ico {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
}

.feed .ico svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.counts {
  display: flex;
  gap: 14px;
  padding: 0 20px 10px;
  color: var(--muted);
  font-size: 13px;
}

.counts b {
  color: var(--ink);
  font-weight: 600;
}

.note-row {
  display: flex;
  gap: 6px;
  padding: 0 20px 12px;
}

.note-row input {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font: inherit;
}

.lanterns li .x {
  margin-left: 6px;
  border: 0;
  background: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 12px;
}

.lanterns li q {
  display: block;
  quotes: none;
  color: var(--muted);
  font-style: italic;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  background: #eaf1e2;
  color: var(--good);
  font-size: 12px;
  font-weight: 600;
}

.pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
}

.motto {
  margin: 6px 20px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--bg);
  border-radius: 0 8px 8px 0;
  font: italic 500 14px var(--serif);
}

@media (max-width: 760px) {
  .nav,
  .emotes {
    display: none;
  }
  .talk {
    left: 12px;
    right: 12px;
    bottom: 124px;
  }
  .panel:not([hidden]) ~ .talk {
    display: none;
  }
}
