:root {
  --parchment: #f3e2bc;
  --parchment-light: #f8ebcd;
  --parchment-dark: #e7d1a4;
  --edge: #8a6a3e;
  --edge-dark: #5e4426;
  --ink: #42301d;
  --ink-soft: #705b3d;
  --green: #3f7f45;
  --green-light: #58a05e;
  --gold: #e0a93c;
  --red: #b23a2e;
  --cream: #fff7e3;
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  --font: "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Arial Unicode MS", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

html {
  background: #07110b;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

/* ---------------------------------------------------------------- background */

.bg {
  position: fixed;
  inset: -12px;
  z-index: -2;
  background: url("/assets/background.png") center center / cover no-repeat;
  filter: blur(2.5px) brightness(0.55) saturate(0.9);
  transform: scale(1.04);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 28%, rgba(20, 42, 28, 0.12), rgba(3, 10, 6, 0.78) 78%),
    linear-gradient(180deg, rgba(4, 16, 10, 0.55), rgba(3, 9, 6, 0.84));
}

/* ---------------------------------------------------------------- layout */

.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 247, 227, 0.58);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.brand-dot {
  color: var(--gold);
  opacity: 0.8;
}

/* ---------------------------------------------------------------- card */

.card {
  position: relative;
  width: min(92vw, 440px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 30px 32px 24px;
  border: 3px solid var(--edge);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 255, 255, 0.55), transparent 58%),
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.024) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, var(--parchment-light) 0%, var(--parchment) 55%, var(--parchment-dark) 100%);
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  scrollbar-width: thin;
  animation: cardIn 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(138, 106, 62, 0.24);
  border-radius: 14px;
  pointer-events: none;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.crest {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}

.crest img {
  width: 58px;
  height: 58px;
  filter: drop-shadow(0 4px 8px rgba(60, 40, 20, 0.28));
}

h1 {
  margin: 6px 0 0;
  text-align: center;
  color: #3b2a18;
  font-size: clamp(42px, 9vw, 58px);
  line-height: 1.06;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45),
    0 3px 12px rgba(80, 50, 20, 0.18);
}

.en {
  margin: 4px 0 0;
  text-align: center;
  color: #8a6428;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.sub {
  margin: 7px 0 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  margin: 20px 0 13px;
  border-bottom: 2px solid rgba(138, 106, 62, 0.28);
}

.tab {
  flex: 1;
  margin-bottom: -2px;
  padding: 10px 0 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: #7a6242;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--green);
}

.tab.is-active {
  color: #2f6f3a;
  border-bottom-color: var(--green);
}

.tab:focus-visible,
.link:focus-visible,
.primary:focus-visible,
.ghost:focus-visible,
.game-btn:focus-visible {
  outline: 3px solid rgba(224, 169, 60, 0.65);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- form */

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 2px solid #b99a68;
  border-radius: 10px;
  background: #fff8e7;
  color: #3b2a18;
  font-size: 16px;
  box-shadow: inset 0 2px 4px rgba(90, 60, 30, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: rgba(112, 91, 61, 0.55);
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--green);
  background: #fffdf4;
  box-shadow:
    0 0 0 3px rgba(63, 127, 69, 0.16),
    inset 0 2px 4px rgba(90, 60, 30, 0.06);
}

input:disabled {
  opacity: 0.55;
}

.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.message {
  min-height: 18px;
  margin: -1px 0 0;
  color: var(--red);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.message.success {
  color: var(--green);
}

.primary {
  width: 100%;
  height: 52px;
  border: 2px solid var(--edge-dark);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--green-light), var(--green));
  color: var(--cream);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  box-shadow:
    0 4px 0 #2c5a31,
    0 8px 18px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
}

.primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.primary:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 #2c5a31,
    0 4px 10px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.primary:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

.primary.big {
  height: 62px;
  margin-top: 4px;
  font-size: 21px;
}

.ghost {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: rgba(255, 247, 227, 0.38);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ghost:hover {
  background: rgba(255, 247, 227, 0.7);
  border-color: var(--edge-dark);
}

.hint {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: #2f6f3a;
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.note {
  margin: 15px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(138, 106, 62, 0.32);
  color: rgba(66, 48, 29, 0.64);
  font-size: 11.5px;
  line-height: 1.65;
  text-align: center;
}

/* ---------------------------------------------------------------- welcome */

.eyebrow {
  margin: 8px 0 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-align: center;
}

.welcome-card h2 {
  margin: 4px 0 0;
  color: #3b2a18;
  font-size: 34px;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
}

.welcome-card .sub {
  margin-bottom: 18px;
}

.welcome-card .primary,
.welcome-card .ghost {
  display: block;
}

/* ---------------------------------------------------------------- footer */

.footer {
  margin-top: 2px;
  color: rgba(255, 247, 227, 0.55);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

/* ---------------------------------------------------------------- game */

.game-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
}

.game-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.game-bar {
  position: fixed;
  top: auto;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  right: calc(env(safe-area-inset-right) + 12px);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.game-btn {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 247, 227, 0.3);
  border-radius: 8px;
  background: rgba(8, 14, 10, 0.62);
  color: var(--cream);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  opacity: 0.78;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.game-btn:hover {
  opacity: 1;
  background: rgba(8, 14, 10, 0.85);
}

body.playing {
  overflow: hidden;
}

body.playing .page,
body.playing .bg {
  display: none;
}

body.playing::after {
  display: none;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  z-index: 2000;
  width: max-content;
  max-width: min(90vw, 430px);
  padding: 10px 16px;
  border: 1px solid rgba(224, 169, 60, 0.55);
  border-radius: 10px;
  background: rgba(12, 20, 14, 0.94);
  color: var(--cream);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  animation: toastIn 0.18s ease both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: #08130d;
  color: var(--parchment);
  transition: opacity 0.35s ease;
}

.boot.hide {
  opacity: 0;
  pointer-events: none;
}

.boot-inner {
  text-align: center;
}

.boot-title {
  color: var(--parchment);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-shadow: 0 2px 16px rgba(224, 169, 60, 0.2);
}

.boot p {
  margin: 4px 0 0;
  color: rgba(243, 226, 188, 0.55);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 18px auto 10px;
  border: 3px solid rgba(243, 226, 188, 0.22);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #08130d;
  color: var(--cream);
  font-size: 16px;
  text-align: center;
}

/* ---------------------------------------------------------------- player stats */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0 16px;
  padding: 10px 6px;
  border: 1px solid rgba(138, 106, 62, 0.3);
  border-radius: 12px;
  background: rgba(255, 247, 227, 0.42);
}

.stat {
  display: grid;
  gap: 2px;
  text-align: center;
}

.stat span {
  color: #2f6f3a;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat small {
  color: var(--ink-soft);
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.stat + .stat {
  border-left: 1px dashed rgba(138, 106, 62, 0.25);
}

.welcome-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.welcome-actions .ghost {
  margin-top: 0;
  height: 46px;
}

/* ---------------------------------------------------------------- modals */

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 7, 0.74);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.18s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(94vw, 520px);
  max-height: min(84dvh, 720px);
  padding: 22px 22px 16px;
  border: 3px solid var(--edge);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 255, 255, 0.55), transparent 58%),
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.024) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, var(--parchment-light) 0%, var(--parchment) 55%, var(--parchment-dark) 100%);
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  animation: cardIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(138, 106, 62, 0.24);
  border-radius: 12px;
  pointer-events: none;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(138, 106, 62, 0.22);
}

.modal-head .eyebrow {
  margin: 0;
  text-align: left;
}

.modal-head h3 {
  margin: 2px 0 0;
  color: #3b2a18;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0.06em;
}

.modal-sub {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.modal-close {
  flex: none;
  width: 38px;
  height: 38px;
  border: 2px solid rgba(138, 106, 62, 0.4);
  border-radius: 10px;
  background: rgba(255, 247, 227, 0.5);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover {
  background: rgba(255, 247, 227, 0.88);
  border-color: var(--edge);
}

.modal-close:focus-visible,
.board-tab:focus-visible {
  outline: 3px solid rgba(224, 169, 60, 0.65);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- achievements */

.achievement-list,
.board-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
}

.achievement {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid rgba(138, 106, 62, 0.24);
  border-radius: 12px;
  background: rgba(255, 247, 227, 0.34);
  opacity: 0.72;
}

.achievement.is-unlocked {
  opacity: 1;
  border-color: rgba(63, 127, 69, 0.5);
  background: rgba(255, 247, 227, 0.62);
  box-shadow: inset 0 0 0 1px rgba(63, 127, 69, 0.14);
}

.achievement-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(138, 106, 62, 0.14);
  font-size: 19px;
  line-height: 1;
}

.achievement.is-unlocked .achievement-icon {
  background: rgba(224, 169, 60, 0.28);
  box-shadow: 0 0 0 1px rgba(224, 169, 60, 0.5);
}

.achievement-body {
  flex: 1;
  min-width: 0;
}

.achievement-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.achievement-head strong {
  color: #3b2a18;
  font-size: 14.5px;
}

.achievement-status {
  flex: none;
  color: var(--ink-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.achievement.is-unlocked .achievement-status {
  color: var(--green);
  font-weight: 700;
}

.achievement-body p {
  margin: 2px 0 6px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.achievement-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(138, 106, 62, 0.18);
  overflow: hidden;
}

.achievement-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green-light), var(--green));
  transition: width 0.3s ease;
}

.achievement.is-unlocked .achievement-bar i {
  background: linear-gradient(90deg, var(--gold), #c78a1e);
}

/* ---------------------------------------------------------------- leaderboard */

.board-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.board-tab {
  flex: 1;
  height: 40px;
  border: 2px solid rgba(138, 106, 62, 0.3);
  border-radius: 10px;
  background: rgba(255, 247, 227, 0.32);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.board-tab.is-active {
  border-color: var(--green);
  background: rgba(63, 127, 69, 0.14);
  color: #2f6f3a;
}

.board-level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.board-level-row label {
  flex: none;
  color: var(--ink-soft);
  font-size: 12px;
}

.board-level-row select {
  flex: 1;
  height: 40px;
  padding: 0 10px;
  border: 2px solid #b99a68;
  border-radius: 9px;
  background: #fff8e7;
  color: #3b2a18;
  font-family: inherit;
  font-size: 14px;
}

.board-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(138, 106, 62, 0.22);
  border-radius: 10px;
  background: rgba(255, 247, 227, 0.32);
}

.board-row.is-me {
  border-color: var(--green);
  background: rgba(63, 127, 69, 0.14);
}

.board-rank {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board-row.is-top-1 .board-rank {
  color: #b8860b;
  font-size: 17px;
}

.board-row.is-top-2 .board-rank {
  color: #7c8794;
  font-size: 16px;
}

.board-row.is-top-3 .board-rank {
  color: #a2662f;
  font-size: 15px;
}

.board-name {
  overflow: hidden;
  color: #3b2a18;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-score {
  color: #2f6f3a;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board-empty {
  padding: 22px 10px;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.board-me {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(138, 106, 62, 0.3);
  color: var(--ink-soft);
  font-size: 12.5px;
  text-align: center;
}

/* ---------------------------------------------------------------- achievement banner */

.achievement-banner {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 16px);
  z-index: 2100;
  display: flex;
  gap: 12px;
  align-items: center;
  width: max-content;
  max-width: min(92vw, 430px);
  padding: 11px 16px;
  border: 2px solid rgba(224, 169, 60, 0.75);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(30, 44, 26, 0.97), rgba(12, 22, 15, 0.97));
  color: var(--cream);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -14px);
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.28s ease;
}

.achievement-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.achievement-banner-icon {
  flex: none;
  font-size: 26px;
  line-height: 1;
}

.achievement-banner-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.achievement-banner-text strong {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.achievement-banner-text span {
  font-size: 13.5px;
  line-height: 1.4;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 520px) {
  .card {
    width: min(94vw, 420px);
    padding: 24px 21px 20px;
  }

  h1 {
    font-size: 44px;
  }

  .brand {
    font-size: 9px;
    letter-spacing: 0.2em;
  }

  .footer {
    font-size: 10px;
  }

  .modal-card {
    width: min(96vw, 460px);
    padding: 18px 16px 14px;
  }

  .stat span {
    font-size: 15px;
  }

  .board-row {
    grid-template-columns: 32px 1fr auto;
    padding: 8px 10px;
  }
}

@media (max-height: 640px) {
  .page {
    justify-content: flex-start;
    padding-top: 12px;
  }

  .brand,
  .footer {
    display: none;
  }

  .card {
    max-height: calc(100dvh - 24px);
  }
}

@media (max-height: 540px) {
  .card {
    padding: 14px 20px 12px;
  }

  .crest,
  .en,
  .sub,
  .note {
    display: none;
  }

  h1 {
    margin-top: 0;
    font-size: 30px;
  }

  .tabs {
    margin: 6px 0 8px;
  }

  form {
    gap: 7px;
  }

  input[type="text"],
  input[type="password"] {
    height: 40px;
  }

  .message {
    min-height: 14px;
    font-size: 12px;
  }

  .primary {
    height: 42px;
    font-size: 15px;
  }

  .primary.big {
    height: 48px;
    font-size: 17px;
  }

  .hint {
    margin-top: 6px;
    font-size: 12px;
  }

  .welcome-card .sub {
    display: block;
    margin-bottom: 8px;
  }

  .welcome-card h2 {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
