:root {
  --bg-top: #111827;
  --bg-bottom: #1f2937;
  --panel: rgba(17, 24, 39, 0.7);
  --text: #f9fafb;
  --accent: #34d399;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
  z-index: 2;
}

.score-wrap {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.label {
  font-size: 12px;
  opacity: 0.8;
  margin-right: 8px;
}

#score {
  font-size: 22px;
}

#best-score {
  font-size: 18px;
  color: #fde68a;
}

.best-label {
  margin-left: 14px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.46);
  backdrop-filter: blur(3px);
  z-index: 4;
}

.overlay.hidden {
  display: none;
}

.modal-card {
  width: min(92vw, 460px);
  padding: 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.modal-card h1,
.modal-card h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.modal-card h2 {
  font-size: 24px;
}

.modal-tip {
  font-size: 14px;
  opacity: 0.88;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-btn {
  border: 1px solid rgba(52, 211, 153, 0.36);
  background: rgba(16, 185, 129, 0.18);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}

.menu-btn:hover {
  border-color: var(--accent);
}

.menu-btn.ghost {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.6);
}

.skin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.skin-card {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.68);
  border-radius: 12px;
  padding: 10px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  touch-action: manipulation;
}

.skin-card img {
  width: 90px;
  height: 90px;
  object-fit: contain;
}

.skin-card span {
  font-size: 14px;
}

.skin-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35) inset;
}

.skin-card:hover {
  border-color: rgba(52, 211, 153, 0.75);
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  max-height: 260px;
  overflow: auto;
}

@media (max-width: 860px) {
  .modal-card h1,
  .modal-card h2 {
    font-size: 22px;
  }
}

.top-item {
  display: grid;
  grid-template-columns: 28px 52px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.top-rank {
  font-size: 12px;
  opacity: 0.7;
}

.top-score {
  font-size: 16px;
  color: #86efac;
  font-weight: 700;
}

.top-time {
  font-size: 12px;
  opacity: 0.82;
  text-align: right;
}

.board-empty {
  font-size: 13px;
  opacity: 0.75;
  margin-bottom: 12px;
}

.over-score {
  font-size: 18px;
  margin: 10px 0 8px;
}

.over-comment {
  font-size: 14px;
  opacity: 0.92;
  line-height: 1.5;
  margin: 0 0 16px;
}

.hidden {
  display: none;
}
