:root {
  --bg: #030208;
  --panel: #0d0a16;
  --tile: #1b172d;
  --tile-border: rgba(255, 255, 255, 0.1);
  --accent: #ff6c95;
  --muted: #8c8697;
  --text: #ffffff;
  --p1: linear-gradient(135deg, #ffd86b, #ff9d4f);
  --p2: linear-gradient(135deg, #8fe2ff, #6f7dff);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
}

[v-cloak] {
  display: none;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px clamp(14px, 5vw, 28px) 140px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-line p {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.status-line .sep {
  color: var(--muted);
}

.board-area {
  background: var(--panel);
  border-radius: 26px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

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

.tile {
  position: relative;
  border-radius: 9px;
  background: var(--tile);
  min-height: 48px;
  border: 1px solid var(--tile-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.tile--start {
  background: #123640;
  border-color: rgba(94, 234, 212, 0.6);
}

.tile--goal {
  background: #3f163f;
  border-color: rgba(248, 250, 109, 0.7);
}

.tile--special {
  box-shadow: 0 0 10px rgba(255, 108, 149, 0.2);
}

.tile--completed {
  background: #2c2842;
  border-color: rgba(255, 255, 255, 0.25);
}

.tile--goal-hit {
  animation: goalGlow 1.2s ease-out 0s 3 alternate;
  box-shadow: 0 0 25px rgba(255, 213, 128, 0.8);
}

.tile__number {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

.tile--goal .tile__number {
  color: #fff3cb;
}

.tile__tag {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tile--start .tile__tag {
  color: #a8f4ff;
}

.tile--goal .tile__tag {
  color: #ffe7a3;
}
.tile__icon {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #130d1f;
}

.tile__icon--boost {
  background: #9effc5;
}

.tile__icon--back {
  background: #ffb2cf;
}

.tokens {
  display: flex;
  gap: 4px;
}

.token {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #1d1425;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.4);
}

.token--p1 {
  background: var(--p1);
}

.token--p2 {
  background: var(--p2);
}

.action-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 24px));
  background: rgba(8, 5, 16, 0.95);
  border-radius: 24px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}

.level-select {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--muted);
  gap: 4px;
}

.level-select__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.level-select__label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.level-select select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 8px 10px;
}

.level-select select:focus {
  outline: none;
}

.dice {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dice__label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.dice__value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  min-height: 2.4rem;
}

.dice__value.animate {
  animation: roll 0.4s ease;
}

@keyframes roll {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.7);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.dice__turn {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.actions {
  display: flex;
  align-items: stretch;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn.primary {
  background: linear-gradient(135deg, #ff81a8, #ffc36a);
  color: #1b1426;
}

.btn-roll {
  font-size: 1.2rem;
  padding: 16px 12px;
  width: 100%;
  box-shadow: 0 18px 25px rgba(255, 129, 168, 0.4);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-reset {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  opacity: 0.9;
}

.btn-reset:hover {
  opacity: 1;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn:not(:disabled):active {
  transform: scale(0.97);
}

.task-modal {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 20;
}

.task-modal.hidden {
  display: none;
}

.task-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 3, 10, 0.6);
  backdrop-filter: blur(6px);
}

.task-modal__sheet {
  position: relative;
  background: var(--panel);
  padding: 28px;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -18px 30px rgba(0, 0, 0, 0.6);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.task-modal__title {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.task-modal__action {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  display: none;
}

.task-modal__action.active {
  display: block;
}

.task-modal__task {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.8;
}

@keyframes goalGlow {
  0% {
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.5);
  }
  70% {
    transform: scale(1.04);
    border-color: rgba(255, 219, 133, 0.9);
  }
  100% {
    transform: scale(1.02);
    border-color: rgba(255, 255, 255, 0.7);
  }
}

@media (max-width: 420px) {
  .board {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .action-bar {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
