@media (max-width: 640px) {
  .game-info-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .game-info-bar > * { flex: none; }
  .difficulty-selector { justify-content: center; }
  .game-actions { justify-content: center; }
}

.timer {
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #2c3e50;
  min-width: 76px;
  text-align: center;
  padding: 6px 14px;
  background: #f8f6f2;
  border-radius: 10px;
  border: 2px solid #e8e3da;
}

.timer-block { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.timer-records { font-size: 10px; line-height: 1.35; color: #7f8c8d; text-align: center; white-space: nowrap; }
.timer-records .rec-label { color: #95a5a6; font-weight: 600; }
.timer-records .rec-user { color: #2c3e50; font-weight: 700; }
.timer-records .rec-time { font-family: 'Courier New', monospace; color: #3498db; font-weight: 700; }
.timer-records .rec-empty { color: #bdc3c7; }

.game-main {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.grid-wrapper {
  position: relative;
  padding: 4px;
  background: #2c3e50;
  border-radius: 8px;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.25),
    0 4px 12px rgba(0,0,0,0.1);
}

#grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 468px;
  height: 468px;
  background: #fff;
  position: relative;
}

@media (max-width: 540px) {
  #grid { width: calc(100vw - 48px); height: calc(100vw - 48px); }
  .cell { font-size: calc((100vw - 48px) / 9 * 0.56) !important; }
  .pencil-mark { font-size: calc((100vw - 48px) / 9 * 0.2) !important; }
  .grid-wrapper { width: calc(100vw - 40px); }
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 28px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  line-height: normal;
  cursor: pointer;
  user-select: none;
  background: #fff;
  border: none;
  border-right: 1px solid #d0ccc4;
  border-bottom: 1px solid #d0ccc4;
  transition: background 0.1s ease;
  color: #2c3e50;
  padding: 0;
}

.cell.border-left { border-left: 2.5px solid #2c3e50; }
.cell.border-top { border-top: 2.5px solid #2c3e50; }
.cell.border-right { border-right: 2.5px solid #2c3e50; }
.cell.border-bottom { border-bottom: 2.5px solid #2c3e50; }

.cell:hover {
  background: #f0ede8;
}

.cell.selected {
  background: #fff3cd !important;
  box-shadow: inset 0 0 0 2px #f0ad4e;
  z-index: 2;
}

.cell.highlighted {
  background: #eaf1f8;
}

.cell.given {
  font-weight: 700;
  color: #2c3e50;
}

.cell.user-input {
  font-weight: 600;
  color: #2980b9;
}

.cell.error {
  background: #fce4e4 !important;
  animation: errorPulse 1.5s ease-in-out infinite;
  z-index: 3;
}

@keyframes errorPulse {
  0%, 100% { box-shadow: inset 0 0 4px rgba(231,76,60,0.35); }
  50% { box-shadow: inset 0 0 14px rgba(231,76,60,0.55); }
}

.cell.hint-cell {
  animation: hintGlow 1s ease-in-out 3;
  z-index: 4;
}

@keyframes hintGlow {
  0%, 100% { box-shadow: inset 0 0 4px rgba(243,156,18,0.3); background: #fef9e7; }
  50% { box-shadow: inset 0 0 18px rgba(243,156,18,0.6); background: #fcf3cf; }
}

.cell.same-number::after {
  content: '';
  position: absolute;
  top: 7%;
  left: 7%;
  width: 86%;
  height: 86%;
  border: 2px solid rgba(240, 173, 78, 0.85);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.cell.conflict {
  color: #fff;
  z-index: 1;
}

.cell.conflict::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  background: #e74c3c;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}

.cell.conflict.same-number::after {
  display: none;
}

.welcome-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  z-index: 10;
  border-radius: 4px;
}

.welcome-content {
  text-align: center;
  color: #5a6a7a;
  font-size: 16px;
  line-height: 1.6;
}

.welcome-icon {
  font-size: 52px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

.pencil-marks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.pencil-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #7f8c8d;
  font-family: 'Segoe UI', sans-serif;
  font-weight: 600;
  line-height: 1;
}

