* {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #f1f5f9;
  font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, 'Roboto', sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.game-container {
  background: white;
  border-radius: 32px;
  box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.15);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  width: 100%;
  transition: all 0.2s;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 2px solid #eef2ff;
  padding-bottom: 12px;
}
.title-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}
.title-icon {
  font-size: 1.8rem;
}
.timer {
  background: #0f172a;
  color: white;
  font-family: monospace;
  font-size: 1.3rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 60px;
  letter-spacing: 1px;
  box-shadow: inset 0 0 0 1px #334155, 0 2px 6px rgba(0,0,0,0.05);
}

.game-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.board-area {
  background: white;
  border-radius: 20px;
  overflow-x: auto;
  overflow-y: auto;
  max-width: 100%;
  display: flex;
  justify-content: center;
}

.samurai-board {
  display: grid;
  grid-template-columns: repeat(21, minmax(30px, 36px));
  background-color: #e2e8f0;
  gap: 1px;
  border: 2px solid #334155;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.cell {
  aspect-ratio: 1 / 1;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  color: #0f172a;
  transition: 0.05s linear;
  cursor: pointer;
  font-family: 'Courier New', 'Fira Code', monospace;
}

.cell.inactive {
  background-color: transparent !important;
  border: none !important;
  cursor: default;
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

.cell.col-8, .cell.col-17 {
  border-right: 2px solid #334155 !important;
}
.cell.row-8, .cell.row-17 {
  border-bottom: 2px solid #334155 !important;
}
.cell {
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}

.cell.selected {
  background-color: #bae6fd !important;
  box-shadow: inset 0 0 0 2px #0284c7;
  z-index: 2;
}

.cell.highlight {
  background-color: #fff2cc !important;
}
.cell.selected.highlight {
  background-color: #bae6fd !important;
}

.cell.given {
  color: #1e3a8a;
  font-weight: 700;
  background-color: #f8fafc;
}

.cell.user-number {
  color: #0f172a;
  font-weight: 500;
}

.cell.error {
  background-color: #fee2e2 !important;
  color: #b91c1c;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: #ef4444;
}

.sidebar {
  background: #ffffff;
  border-radius: 28px;
  padding: 16px 18px;
  width: 240px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.03);
  border: 1px solid #eef2ff;
}

.difficulty-section {
  margin-bottom: 28px;
}

.difficulty-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
}

.difficulty-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.difficulty-btn {
  background: #f1f5f9;
  border: none;
  padding: 6px 12px;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: 0.15s;
  font-family: inherit;
}

.difficulty-btn.active {
  background: #0f172a;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.difficulty-btn:hover {
  background: #e2e8f0;
}

.number-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 16px;
}

.num-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 48px;
  aspect-ratio: 1 / 1;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: monospace;
  color: #0f172a;
  cursor: pointer;
  transition: 0.1s linear;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.num-btn:hover {
  background: #eef2ff;
  transform: scale(0.96);
}

.action-buttons-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 18px;
}
.action-btn {
  border: none;
  width: 100%;
  padding: 10px 0;
  border-radius: 60px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.btn-new-game { background: #10b981; }
.btn-new-game:hover { background: #059669; transform: scale(0.98); }
.btn-undo { background: #f59e0b; }
.btn-undo:hover { background: #d97706; transform: scale(0.98); }

.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 6px;
}
.export-btn {
  border: none;
  width: 100%;
  padding: 10px 0;
  border-radius: 60px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  background: #4f46e5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.export-btn.print-btn { background: #3b82f6; }
.export-btn.print-btn:hover { background: #2563eb; transform: scale(0.98); }
.export-btn.download-btn { background: #8b5cf6; }
.export-btn.download-btn:hover { background: #7c3aed; transform: scale(0.98); }

.game-footer {
  margin-top: 10px;
  border-top: 2px solid #eef2ff;
  padding-top: 20px;
}
.rule-block {
  background: #f8fafc;
  border-radius: 24px;
  padding: 18px 22px;
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}
.rule-block h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
}
.rule-visual {
  margin-top: 16px;
  background: #eef2ff;
  border-radius: 20px;
  padding: 12px;
  text-align: center;
  display: inline-block;
  width: auto;
}
.tips-list {
  padding-left: 20px;
  margin: 8px 0;
}
.tips-list li { margin: 6px 0; }

.copyright {
  text-align: center;
  font-size: 0.75rem;
  color: #475569;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.copyright a {
  color: #1e3a8a;
  text-decoration: none;
  margin: 0 4px;
}

@media (max-width: 860px) {
  .game-container { padding: 16px; }
  .samurai-board { grid-template-columns: repeat(21, minmax(26px, 32px)); }
  .cell { font-size: 0.8rem; }
  .sidebar { width: 210px; }
  .num-btn { font-size: 1.2rem; }
  .title-area { font-size: 1.2rem; }
  .timer { font-size: 1rem; padding: 4px 10px; }
}

@media print {
  body * {
    visibility: hidden;
  }
  .board-area, .board-area * {
    visibility: visible;
  }
  .board-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .samurai-board {
    transform: scale(0.9);
    transform-origin: top left;
  }
}
 /* Language switcher style ¡ª Maintain consistency with the original design system */
    .language-switcher {
      margin-top: 18px;
      border-top: 1px solid #eef2ff;
      padding-top: 16px;
    }
    .language-title {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      font-weight: 600;
      color: #475569;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .language-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }
    .lang-link {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 40px;
      padding: 6px 4px;
      font-size: 0.7rem;
      font-weight: 500;
      text-align: center;
      text-decoration: none;
      color: #1e293b;
      transition: 0.1s linear;
      display: block;
      cursor: pointer;
    }
    .lang-link:hover {
      background: #eef2ff;
      transform: scale(0.96);
      border-color: #cbd5e1;
    }
    .lang-link.active {
      background: #0f172a;
      color: white;
      border-color: #0f172a;
      pointer-events: none;
      font-weight: 600;
    }
    @media (max-width: 860px) {
      .lang-link { font-size: 0.65rem; padding: 5px 2px; }
    }