/* Crownmarch, phone version. Same look as the PC client: dark wood and leather, brass trim,
   parchment text, Cinzel for headings and Alegreya for body text. */
@font-face { font-family: Cinzel; font-weight: 700; src: url(assets/fonts/cinzel-latin-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Cinzel; font-weight: 400; src: url(assets/fonts/cinzel-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Alegreya; font-weight: 400; src: url(assets/fonts/alegreya-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Alegreya; font-weight: 700; src: url(assets/fonts/alegreya-latin-700-normal.woff2) format("woff2"); font-display: swap; }

:root {
  --ink: #f5e6c2; --ink-dim: #ccb894; --gold: #dbad57; --gold-dark: #85612b;
  --leather: #2b1f17; --leather-light: #3d2b1f; --backdrop: #17120f;
  --good: #8cd973; --bad: #f27361; --plate: #6b4524; --plate-hi: #8c5c2e;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Text size: every font size is multiplied by this. Settings > Text size changes it (small 1, normal 1.1,
     large 1.25, extra large 1.4); normal is a little bigger than the game first shipped with. */
  --ts: 1.1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--backdrop); color: var(--ink); overflow: hidden;
  font: calc(17px * var(--ts))/1.35 Alegreya, Georgia, serif; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
input { -webkit-user-select: text; user-select: text; }
.hidden { display: none !important; }
#app, .screen { position: fixed; inset: 0; }
h1, h2, h3, button, .title { font-family: Cinzel, Georgia, serif; }
h2 { margin: 0 0 8px; font-size: calc(21px * var(--ts)); color: var(--gold); }
h3 { margin: 14px 0 6px; font-size: calc(16px * var(--ts)); color: var(--gold); }
.error { color: var(--bad); min-height: 1.2em; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.dim { color: var(--ink-dim); }
.small { font-size: calc(14px * var(--ts)); }

button { font-size: calc(15px * var(--ts)); font-weight: 700; color: var(--ink); background: linear-gradient(#7a5029, #573618);
  border: 2px solid var(--gold); border-radius: 8px; padding: 10px 14px; min-height: 44px;
  box-shadow: 0 2px 0 #0008, inset 0 1px 0 #fff3; touch-action: manipulation; }
button:active { background: #4d2f17; color: var(--gold); transform: translateY(1px); }
button:disabled { opacity: .45; border-color: #615141; }
button.primary { background: linear-gradient(#a8742f, #74491c); }
button.big { width: 100%; font-size: calc(18px * var(--ts)); padding: 14px; }
button.round { width: 48px; height: 48px; border-radius: 50%; padding: 0; font-size: calc(24px * var(--ts)); }
button.small { min-height: 36px; padding: 6px 10px; font-size: calc(13px * var(--ts)); }
input, select { width: 100%; font: inherit; font-size: calc(17px * var(--ts)); color: var(--ink); background: #120d0a;
  border: 1px solid var(--gold-dark); border-radius: 6px; padding: 10px; margin-top: 4px; }
input:focus { outline: 2px solid var(--gold); }
label { display: block; margin: 10px 0; color: var(--ink-dim); font-size: calc(15px * var(--ts)); }

/* Login */
#login { background: radial-gradient(ellipse at 50% 30%, #3a2a1c, var(--backdrop) 70%), var(--backdrop);
  overflow-y: auto; padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); }
.login-card { max-width: 420px; margin: 0 auto; background: linear-gradient(var(--leather-light), var(--leather));
  border: 2px solid var(--gold); border-radius: 14px; padding: 22px 18px; box-shadow: 0 10px 40px #000a; }
.login-card h1 { text-align: center; color: var(--gold); font-size: calc(34px * var(--ts)); line-height: 1.05; margin: 4px 0 6px;
  text-shadow: 0 2px 0 #000; }
.login-card h1 small { font-size: calc(18px * var(--ts)); color: var(--ink-dim); }
.tag { text-align: center; color: var(--ink-dim); margin: 0 0 12px; font-style: italic; }
.hint { font-size: calc(14px * var(--ts)); color: var(--ink-dim); }
/* Link to the game's Discord server (login card and alliance page). */
.community { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 10px 14px; border-radius: 10px;
  background: #5865f2; color: #fff; text-decoration: none; box-shadow: 0 2px 0 #0006; }
.community.forum-link { background: linear-gradient(#7a5029, #573618); border: 1px solid var(--gold); color: var(--ink); }
.community img { width: 30px; height: 30px; flex: none; }
.community span { display: flex; flex-direction: column; line-height: 1.2; }
.community b { font-size: calc(16px * var(--ts)); }
.community small { font-size: calc(13px * var(--ts)); opacity: .85; }
.credits { font-size: calc(12px * var(--ts)); color: #9c8a70; margin-top: 18px; }

/* Game */
#game { display: flex; flex-direction: column; }
#top { padding: calc(6px + var(--safe-top)) 8px 6px; background: linear-gradient(#2e2219, #1c1510);
  border-bottom: 2px solid var(--gold-dark); z-index: 3; }
#who { display: flex; justify-content: space-between; gap: 12px; font-family: Cinzel, serif; font-size: calc(14px * var(--ts)); color: var(--gold); }
#who-shield { color: #8fc3e8; font-family: Alegreya, serif; }
#res { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 4px; }
.res { display: flex; align-items: center; gap: 3px; background: #0006; border: 1px solid #5c4329; border-radius: 6px;
  padding: 2px 4px; font-size: calc(14px * var(--ts)); font-weight: 700; white-space: nowrap; overflow: hidden; }
.res img { width: 18px; height: 18px; flex: none; }
.res.full { color: #f5c26b; }
#view { position: relative; flex: 1; overflow: hidden; background: #0d0a08; }
#view canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#page { position: absolute; inset: 0; overflow-y: auto; padding: 12px 12px 24px; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% 0, #2c2118, var(--backdrop) 80%); }
#queue { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 2; }
#queue .q.tap { pointer-events: auto; cursor: pointer; }
.q-fast { margin-left: 4px; color: var(--gold); }
.q { background: #000b; border: 1px solid var(--gold-dark); border-radius: 6px; padding: 3px 8px; font-size: calc(13px * var(--ts));
  display: flex; gap: 6px; align-items: center; }
.q img { width: 16px; height: 16px; }
#map-hud { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; }
#minimap-box { position: absolute; right: 8px; top: 8px; width: 150px; z-index: 2; display: flex; flex-direction: column; gap: 4px; }
#view canvas#minimap { position: static; width: 150px; height: 104px;
  border: 2px solid var(--gold-dark); border-radius: 6px; box-shadow: 0 2px 8px #000a; cursor: pointer; }
#goto { display: flex; gap: 4px; }
#goto input { width: 0; flex: 1; min-width: 0; padding: 3px 4px; font-size: calc(13px * var(--ts)); text-align: center; background: #000c;
  border: 1px solid var(--gold-dark); border-radius: 5px; color: var(--ink, #f5e6c2); -moz-appearance: textfield; }
#goto input::-webkit-outer-spin-button, #goto input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#goto button { padding: 3px 8px; min-height: 0; }
#find { padding: 4px 6px; min-height: 0; font-size: calc(12.5px * var(--ts)); white-space: nowrap; }
.find-input { width: 100%; font-size: calc(16px * var(--ts)); padding: 8px 10px; margin: 4px 0 6px; }
.find-head { margin: 10px 0 0; font-size: calc(13px * var(--ts)); color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }
#map-coords { cursor: pointer; background: #000b; border-radius: 6px; padding: 2px 8px; font-size: calc(13px * var(--ts)); }

#tabs { display: grid; grid-template-columns: repeat(7, 1fr); background: linear-gradient(#2e2219, #17110c);
  border-top: 2px solid var(--gold-dark); padding-bottom: var(--safe-bottom); z-index: 3; }
#tabs button { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 6px 0 5px; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: calc(9.5px * min(var(--ts), 1.25)); color: var(--ink-dim); position: relative; }
#tabs button img { width: 26px; height: 26px; opacity: .65; }
#tabs button.on { color: var(--gold); background: linear-gradient(#0000, #dbad5722); }
#tabs button.on img { opacity: 1; filter: sepia(1) saturate(3) hue-rotate(-12deg) brightness(.95); }
.dot { position: absolute; top: 6px; right: 22%; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }

/* Bottom sheet */
#sheet-back { position: fixed; inset: 0; background: #0007; z-index: 8; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78%; overflow-y: auto; z-index: 9;
  background: linear-gradient(var(--leather-light), var(--leather)); border-top: 2px solid var(--gold);
  border-radius: 16px 16px 0 0; padding: 6px 14px calc(16px + var(--safe-bottom)); box-shadow: 0 -8px 30px #000a;
  animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40%); opacity: .4; } }
.grip { width: 44px; height: 5px; border-radius: 3px; background: var(--gold-dark); margin: 2px auto 10px; }
.head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.head img.pic { width: 84px; height: 64px; object-fit: contain; flex: none; }
.head img.ico { width: 48px; height: 48px; flex: none; }
.head .t { flex: 1; }
.head .t h2 { margin: 0; }
.cost { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0; font-size: calc(15px * var(--ts)); }
.cost span { display: inline-flex; align-items: center; gap: 3px; }
.cost img { width: 16px; height: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.seat { display: flex; gap: 10px; align-items: center; background: #0004; border: 1px solid #5c4329; border-radius: 10px; padding: 10px; margin: 8px 0; }
.seat.top { border: 2px solid var(--gold); background: linear-gradient(#3a2814, #1a120c); }
.seat.you { outline: 2px solid #e8c46a; }
.seat .t { flex: 1; min-width: 0; }
.seat-name { font-family: Cinzel, Georgia, serif; color: var(--gold); font-size: calc(15px * var(--ts)); }
.seat-ico { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: calc(24px * var(--ts));
  background: radial-gradient(#8c5c2e, #3d2b1f); border: 2px solid var(--gold); }
.card.center { text-align: center; }
.btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btns button { flex: 1; }
.card { background: #0004; border: 1px solid #5c4329; border-radius: 10px; padding: 10px; margin: 8px 0; }
.card.pick { display: flex; gap: 10px; align-items: center; }
.card.pick img { width: 56px; height: 44px; object-fit: contain; }
.card.pick .t { flex: 1; }
.card.off { opacity: .55; }
/* A running timer with its Speed up button on the right. */
.card.timer-card { display: flex; align-items: center; gap: 8px; }
.card.timer-card .t { flex: 1; min-width: 0; }
.card.timer-card .speed-btn { flex: none; white-space: nowrap; }
.speed-head { align-items: center; gap: 8px; }
.speed-head h2 { margin: 0; }
.card.speed-now { text-align: center; }
.card.speed-now .big { font-size: 1.5em; font-weight: 700; color: var(--gold); }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #4a3521; }
.list-item img { width: 34px; height: 34px; flex: none; }
.list-item .t { flex: 1; min-width: 0; }
input[type=range] { padding: 0; margin: 6px 0; accent-color: var(--gold); height: 32px; }
.troop-row { margin: 8px 0; }
.troop-row .row { font-size: calc(15px * var(--ts)); }
.chat { max-height: 260px; overflow-y: auto; background: #0005; border-radius: 8px; padding: 8px; font-size: calc(15px * var(--ts)); }
.chat p { margin: 0 0 6px; }
.chat b { color: var(--gold); }
.seg { display: flex; gap: 6px; margin-bottom: 10px; }
.seg button { flex: 1; min-height: 38px; font-size: calc(13px * var(--ts)); }
.seg button.on { background: linear-gradient(#a8742f, #74491c); color: #fff; }
.report { white-space: pre-wrap; font-size: calc(15px * var(--ts)); }
.scout-report { white-space: normal; display: grid; gap: 6px; margin-top: 8px; }
.scout-report .scout-line { padding-left: 10px; border-left: 2px solid #c8a25a55; }
.study-steps { margin: 6px 0 0; padding-left: 20px; color: #bfae8f; }
.study-steps li.done { color: #8cd973; list-style: none; margin-left: -14px; }
#toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); transform: translateX(-50%); z-index: 20;
  background: #120d0ae8; border: 1px solid var(--gold); border-radius: 10px; padding: 10px 16px; max-width: 90%; text-align: center; }
#toast.bad { border-color: var(--bad); }

@media (orientation: landscape) and (max-height: 500px) {
  #tabs button { min-height: 44px; flex-direction: row; gap: 6px; font-size: calc(12px * min(var(--ts), 1.25)); }
  #tabs button img { width: 22px; height: 22px; }
  #res { grid-template-columns: repeat(5, auto); justify-content: end; margin-top: 0; }
  #top { display: flex; justify-content: space-between; align-items: center; padding-left: calc(8px + env(safe-area-inset-left, 0px)); }
  #sheet { left: auto; width: min(460px, 100%); max-height: 92%; }
}

/* Crown Shop */
#who { align-items: center; }
#who-crowns { margin-left: auto; display: flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 10px;
  font-size: calc(13px * var(--ts)); border-width: 1px; border-radius: 15px; }
#who-crowns img { width: 18px; height: 18px; }
#who-crowns.ready::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.crowns-big { display: flex; align-items: center; gap: 8px; font: 700 calc(24px * var(--ts)) Cinzel, serif; color: var(--gold); }
.crowns-big img { width: 30px; height: 30px; }
.price { display: inline-flex; align-items: center; gap: 4px; }
.price img { width: 15px; height: 15px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shop-grid .card { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.shop-grid .card .btns { margin-top: auto; }
.shop-grid .card img.big { width: 40px; height: 40px; }
.ribbon { display: inline-block; align-self: flex-start; font-size: calc(12px * var(--ts)); font-weight: 700; color: #1c1510; background: var(--gold); border-radius: 4px; padding: 0 6px; }
.notice { border: 1px dashed var(--gold-dark); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
/* Shop pictures. Item icons are white glyphs, so they are tinted gold like on PC. */
.glyph { display: inline-block; flex: none; width: 24px; height: 24px;
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.glyph.big { width: 44px; height: 44px; }
.product .art { width: 72px; height: 72px; align-self: center; }
.big-art { display: block; width: 120px; height: 120px; margin: 0 auto 6px; }
.inside { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: calc(13px * var(--ts)); color: var(--ink-dim); }
.inside .chip { display: flex; align-items: center; gap: 4px; }
.inside .chip .glyph { width: 22px; height: 22px; }
.rarity { display: inline-block; font-size: .72em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid; border-radius: 6px; padding: 0 5px; vertical-align: middle; }
.pack-reveal { border: 2px solid; border-radius: 14px; padding: 18px 14px; text-align: center; margin-bottom: 12px; background: rgba(255,255,255,.04); }
.pack-reveal h2 { margin: 6px 0 4px; }
.boost-on { color: #ffd76a; font-weight: 700; margin: 2px 0 8px; }
.portrait { display: block; border-radius: 10px; object-fit: cover; flex: none; }
.portrait.small { width: 58px; height: 58px; margin-right: 10px; border: 2px solid; }
.portrait.big { width: 160px; height: 160px; margin: 10px auto 4px; border: 3px solid; }
.card.off .portrait { filter: grayscale(1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.chip { border-radius: 999px; padding: 6px 12px; min-height: 0; }
.chip.on { background: linear-gradient(#c9973f, #8a5f24); color: #1b130c; }
input.coord { width: 64px; }
.pity { color: #f0c96a; margin-top: 4px; }

/* Festival stages and army looks (Keep sheet) */
.card.stage { display: flex; gap: 10px; align-items: center; }
.card.stage .t { flex: 1; }
.card.stage .reward { color: var(--good); font-weight: 700; text-align: right; max-width: 40%; }
.card.stage.big .reward { color: #ffd76a; }
.card .bar { height: 6px; background: #0006; border-radius: 3px; margin-top: 4px; overflow: hidden; }
.card .bar i { display: block; height: 100%; background: #e8c46a; }
.card.pick img.squad { object-fit: cover; object-position: 50% 62%; transform: scale(1.9); }

.card.board .row { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid #ffffff14; }
.card.board .row.me { color: #ffd76a; }
.card.board .rank { width: 36px; color: var(--dim, #aaa); }
.card.board .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.mine { font-size: 1.05em; }
details.prizes { margin: 6px 0 10px; }
details.prizes summary { cursor: pointer; color: #e8c46a; }

label.agree { display: flex; gap: 8px; align-items: flex-start; font-size: .9em; text-align: left; line-height: 1.35; }
label.agree input { width: auto; margin-top: 3px; flex: none; }
label.agree a, .credits a, .contact a { color: #e8c46a; }

.chat p { position: relative; padding-right: 30px; }
.chat .chat-more { position: absolute; right: 0; top: 0; background: none; border: none; color: #b7a88a; font-size: 1.1em; padding: 0 6px; min-height: 0; box-shadow: none; }
button.danger { background: #7a2b25; color: #fff; border-color: #a5463d; }
.demolish { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
p.dim a, .small a { color: #e8c46a; }

/* Zoom buttons on the world map */
.zoom-btns { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
button.small-round { width: 40px; height: 40px; min-height: 0; font-size: calc(22px * var(--ts)); line-height: 1; }
