/* ナンプレツール固有スタイル */

.difficulty-group {
  margin-top: 20px;
}

.option-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-tabs--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-tab {
  appearance: none;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.04s ease;
}

.option-tab:hover {
  background: var(--md-sys-color-primary-container);
}

.option-tab:active {
  transform: translateY(1px);
}

.option-tab.is-active {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.game-notice {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: color-mix(in srgb, var(--md-sys-color-primary) 8%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
  font-size: 0.875rem;
  line-height: 1.5;
}

.loading-panel {
  margin-top: 24px;
  padding: 28px 16px;
  text-align: center;
}

.loading-panel__text {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.9375rem;
  font-weight: 600;
}

.game-panel {
  margin-top: 20px;
}

.game-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
}

.status-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, var(--md-sys-color-surface));
  color: var(--md-sys-color-primary);
  font-size: 0.8125rem;
  font-weight: 700;
}

.game-status__timer {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.game-status__timer-label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  font-weight: 600;
}

#timer-display {
  color: var(--md-sys-color-on-surface);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.clear-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--md-sys-color-outline-variant));
  border-radius: var(--md-sys-shape-corner-medium);
  background: color-mix(in srgb, var(--success) 10%, var(--md-sys-color-surface));
}

.clear-banner__title {
  margin: 0 0 4px;
  color: var(--success);
  font-size: 1rem;
  font-weight: 700;
}

.clear-banner__detail {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-size: 0.875rem;
  line-height: 1.5;
}

.board-wrap {
  width: 100%;
  max-width: min(100%, 480px);
  margin: 0 auto 16px;
}

.np-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--md-sys-color-on-surface);
  border-radius: 4px;
  overflow: hidden;
  background: var(--md-sys-color-surface);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.np-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  margin: 0;
  padding: 0;
  border: none;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: clamp(0.95rem, 3.8vw, 1.35rem);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.np-cell:nth-child(9n) {
  border-right: none;
}

.np-cell:nth-child(n+73) {
  border-bottom: none;
}

.np-cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 2px solid var(--md-sys-color-on-surface);
}

.np-cell:nth-child(n+19):nth-child(-n+27),
.np-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid var(--md-sys-color-on-surface);
}

.np-cell.is-given {
  color: var(--md-sys-color-on-surface);
  font-weight: 700;
  cursor: default;
}

.np-cell.is-user {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

.np-cell.is-related {
  background: color-mix(in srgb, var(--md-sys-color-primary) 7%, var(--md-sys-color-surface));
}

.np-cell.is-same-num {
  background: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
}

.np-cell.is-selected {
  background: color-mix(in srgb, var(--md-sys-color-primary) 28%, var(--md-sys-color-surface));
  box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
  z-index: 1;
}

.np-cell.is-error {
  color: var(--danger);
}

.np-cell.is-conflict {
  color: var(--danger);
}

.np-cell.is-hint {
  color: #b86e00;
}

.np-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
  pointer-events: none;
}

.np-notes span {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: clamp(0.45rem, 2vw, 0.65rem);
  font-weight: 500;
  line-height: 1;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
  max-width: min(100%, 480px);
  margin: 0 auto 16px;
}

.numpad__btn {
  appearance: none;
  min-height: 48px;
  padding: 8px 0;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.04s ease;
}

.numpad__btn:hover {
  background: var(--md-sys-color-primary-container);
}

.numpad__btn:active {
  transform: translateY(1px);
}

.numpad__btn.is-active {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.game-controls {
  max-width: min(100%, 480px);
  margin-left: auto;
  margin-right: auto;
}

.game-controls .btn {
  flex: 1 1 calc(50% - 8px);
  min-width: 7.5rem;
  justify-content: center;
}

#note-btn.is-active {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

@media (max-width: 480px) {
  .board-wrap {
    max-width: 100%;
  }

  .numpad {
    gap: 4px;
  }

  .numpad__btn {
    min-height: 44px;
    font-size: 1rem;
  }

  .game-controls .btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
}
