/* Melon Kingdom: shared styles */
:root {
  --accent: #4a7a2a;
  --flesh: #cfeaa0;
  --rind: #c8c27a;
  --btn: #eaf6d5;
  --btn-border: #bcd98f;
  --paper: #fbfdf5;
  --muted: #555555;
  --down: #a3361a;
  --up: #2e6b1f;
}

html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }

body {
  margin: 0;
  background: #ffffff url("../assets/bg-pattern.svg") repeat;
  background-size: 180px 180px;
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  cursor: url("../assets/sword-cursor.svg") 2 2, auto;
}
a, button, label, summary, .choice { cursor: url("../assets/sword-cursor.svg") 2 2, pointer; }
input, textarea, select { cursor: auto; }

a { color: #000000; }
a:hover { color: var(--accent); }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.small { font-size: 11px; }
.serif { font-family: "Times New Roman", Times, serif; }

/* Page frame */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
/* Every page uses the same width, so the header and menu never jump between pages. */

.topbar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.topbar a, nav.kingdom a { display: inline-block; padding: 8px 2px; }

.brand { text-align: center; }
.brand h1 { margin: 0; font-family: "Times New Roman", Times, serif; font-size: 32px; }
.brand p { margin: 4px 0 0; font-style: italic; min-height: 1.4em; }
.brand .divider { display: block; margin: 8px auto 0; }

nav.kingdom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 8px;
  font-size: 13px;
}
@media (max-width: 600px) {
  nav.kingdom { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  nav.kingdom span[aria-hidden="true"] { display: none; }
  nav.kingdom span[data-owner-only] { display: contents; }
  nav.kingdom span[data-owner-only].hidden { display: none !important; }
  nav.kingdom a, nav.kingdom b {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 40px; padding: 4px 6px; box-sizing: border-box; font-size: 12px;
    background: #fff; border: 1px solid var(--btn-border);
  }
  nav.kingdom b { background: var(--btn); border-color: var(--accent); }
}

/* Boxes with the green title bar */
.box {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--accent);
  background: #ffffff;
}
.box > h2 {
  margin: 0;
  background: var(--accent);
  color: #ffffff;
  text-align: center;
  font-size: 13px;
  padding: 3px 0;
  border-bottom: 4px solid var(--flesh);
}
.box-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
/* Same pug-plus-words row at the top of each page */
.intro { display: flex; align-items: center; gap: 18px; }
.intro > img { flex: 0 0 auto; width: 100px; height: auto; }
.intro > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.intro p { margin: 0; }
.lead { font-family: "Times New Roman", Times, serif; font-size: 21px; font-weight: bold; line-height: 1.2; }
@media (max-width: 560px) {
  .intro { gap: 12px; }
  .intro > img { width: 72px; }
  .lead { font-size: 18px; }
}

.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.grow { flex: 1 1 260px; min-width: 0; }
.grid2 { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grid2 > .box { display: flex; flex-direction: column; }
.grid2 > .box > .box-body { flex: 1 1 auto; }
.pair { width: 100%; display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; }
.pair > .box { flex: 1 1 320px; }

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: bold;
  color: #000000;
  text-decoration: none;
  background: var(--btn);
  border: 2px outset var(--btn-border);
  padding: 11px 16px;
  min-height: 44px;
  box-sizing: border-box;
}
.btn:hover { color: #000000; background: #dff0c4; }
.btn-plain { font: inherit; font-size: 12px; color: #000; background: #fff; border: 1px solid var(--btn-border); padding: 6px 10px; min-height: 36px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Times New Roman", Times, serif;
  font-size: 17px;
  font-weight: bold;
  color: #000;
  text-decoration: none;
  background: var(--flesh);
  border: 2px solid #000;
  border-radius: 999px;
  padding: 8px 20px 8px 10px;
  min-height: 44px;
  box-sizing: border-box;
  box-shadow: 3px 3px 0 #000;
}

/* Service cards */
.card { display: flex; flex-direction: column; }
.card .box-body { flex-direction: row; align-items: center; gap: 12px; flex: 1 1 auto; padding: 10px 12px; }
.card img { flex: 0 0 auto; width: 66px; height: auto; }
.card .info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.card p { margin: 0; }

.soon { border: 1px dashed var(--accent); background: var(--paper); padding: 10px 12px; font-style: italic; margin: 0; }
.chip { border: 1px solid var(--accent); background: var(--btn); padding: 2px 8px; font-size: 12px; font-weight: bold; }
.status-up { color: var(--up); font-weight: bold; }
.status-down { color: var(--down); font-weight: bold; }
.status-unknown { color: var(--muted); font-weight: bold; }

/* Hero on the welcome page */
.hero { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; }
.hero > img { width: 110px; height: auto; }
.hero h1 { font-size: 40px; }
@media (max-width: 600px) {
  .hero .brand { order: -1; flex-basis: 100%; }
  .hero > img { width: 88px; }
  .hero { gap: 12px 32px; }
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .legend { font-weight: bold; }
input[type="text"], input[type="email"], select, textarea {
  font: inherit;
  border: 1px solid #000;
  padding: 4px 8px;
  min-height: 36px;
  box-sizing: border-box;
  background: #fff;
}
textarea { resize: vertical; padding: 6px 8px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.choice {
  text-align: left;
  font: inherit;
  color: #000;
  background: #fff;
  border: 2px solid var(--btn-border);
  padding: 8px 10px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.choice[aria-pressed="true"] { background: var(--btn); border-color: var(--accent); }
.choice span { font-size: 12px; color: #444; }
.error { color: var(--down); font-size: 12px; font-weight: bold; }
.receipt { padding: 8px 10px; background: var(--paper); border: 1px dashed var(--accent); display: flex; flex-direction: column; gap: 2px; white-space: pre-line; }

/* Game servers */
.addr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
code.addr {
  flex: 1 1 180px;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  background: var(--paper);
  border: 1px dashed var(--accent);
  padding: 8px 10px;
  overflow-wrap: anywhere;
}
ol, ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; }

/* News */
article { border-top: 1px dashed var(--accent); padding-top: 12px; }
article h3 { margin: 2px 0 4px; font-size: 15px; }
article p { margin: 0; }

/* Status list */
.status-list { list-style: none; padding: 0; gap: 0; }
.status-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px dashed #cfd8c0; }

/* Pip the pet */
.pet-frame { border: 3px double var(--accent); border-radius: 22px; background: var(--paper); padding: 6px 8px; }
.meter-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.meter-row > span:first-child { width: 46px; }
.bar { flex: 1 1 auto; height: 8px; border: 1px solid #000; background: #fff; }
.bar > span { display: block; height: 100%; width: 0; background: #8fbf4f; }
.bar.xp > span { background: #e0b830; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
#pip .btn-row { flex-wrap: nowrap; }
#pip .btn-row .btn { flex: 1 1 0; padding: 11px 6px; text-align: center; }
/* Owner's tool buttons: an even grid */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tool-grid .btn { text-align: center; padding: 11px 8px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.board-head .btn-plain { flex: 0 0 auto; }

/* Tickets: status badges, My Tickets list, one ticket's replies */
.badge { font-size: 12px; font-weight: bold; padding: 2px 8px; border: 1px solid currentColor; background: #fff; white-space: nowrap; }
.badge.s-new { color: #6b5a00; background: #fff8d6; }
.badge.s-waiting { color: var(--up); background: var(--btn); }
.badge.s-gardener { color: #7a3d00; background: #fdebd9; }
.badge.s-done { color: var(--muted); }
.ticket-list { list-style: none; padding: 0; gap: 0; }
.ticket-list li { border-bottom: 1px dashed #cfd8c0; }
.ticket-list a { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 10px 2px; text-decoration: none; }
.ticket-list a > span:first-child { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.ticket-list a b { text-decoration: underline; }
.details { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.details dt { font-weight: bold; }
.details dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 480px) { .details { grid-template-columns: 1fr; } .details dd { margin-bottom: 6px; } }
.thread { list-style: none; padding: 0; gap: 8px; }
.thread li { border: 1px solid var(--btn-border); background: #fff; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.thread li.r-squire { background: var(--paper); border-style: dashed; border-color: var(--accent); }
.thread li.r-gardener { background: var(--btn); border-color: var(--accent); }
.thread .who { font-size: 12px; color: var(--muted); }
.thread .who b { color: #000; }
.thread .body { white-space: pre-line; overflow-wrap: anywhere; }

/* Owner's Kanban board */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; align-items: start; }
.lane { border: 1px solid var(--btn-border); background: var(--paper); min-width: 0; }
.lane > h3 { margin: 0; padding: 6px 8px; font-size: 13px; background: var(--btn); border-bottom: 1px solid var(--btn-border); display: flex; justify-content: space-between; }
.lane .count { font-weight: normal; color: var(--muted); }
.lane > ul { list-style: none; padding: 8px; gap: 8px; min-height: 40px; }
.lane li.empty { font-size: 12px; font-style: italic; color: var(--muted); }
.tcard { border: 1px solid var(--accent); background: #fff; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.tcard .t-title { font-weight: bold; overflow-wrap: anywhere; }
.tcard .t-meta { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.tcard .moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tcard .moves button { font: inherit; font-size: 11px; background: #fff; border: 1px solid var(--btn-border); padding: 4px 2px; min-height: 34px; }
.tcard .moves button:hover { background: var(--btn); }
@media (max-width: 560px) { #pip .pet-frame { margin: 0 auto; } }

/* Town Square chat */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.chat-log { list-style: none; padding: 8px 10px; margin: 0; gap: 6px; border: 1px dashed var(--accent); background: var(--paper); height: 260px; overflow-y: auto; }
.chat-log li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; overflow-wrap: anywhere; }
.chat-log .who { font-weight: bold; }
.chat-log .mine .who { color: var(--accent); }
.chat-log .tag { font-size: 10px; font-weight: bold; border: 1px solid var(--accent); background: var(--btn); padding: 0 4px; }
.chat-log .at { font-size: 11px; color: var(--muted); }
.chat-log .text { flex: 1 1 100%; white-space: pre-line; }
.chat-log .mod { display: flex; gap: 4px; margin-left: auto; }
.chat-log .mod button { font: inherit; font-size: 11px; background: #fff; border: 1px solid var(--btn-border); padding: 2px 6px; min-height: 28px; }
.chat-empty { font-style: italic; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1 1 auto; min-width: 0; min-height: 44px; }
.chat-form .btn { flex: 0 0 auto; }

@media (max-width: 640px) {
  html, body { touch-action: manipulation; }
  input, textarea, select { font-size: 16px; }
}
