:root {
  color-scheme: light;
  --board-bg: #f8d894;
  --grid-color: #7c531c;
  --panel-bg: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(124, 83, 28, 0.2);
  --accent: #ff6b3d;
  --text-main: #2c1a0b;
  --text-muted: #5e4933;
  --shadow: 0 18px 45px rgba(60, 40, 15, 0.18);
  --radius: 18px;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #fdf5e2 0%, #f2e1bf 100%);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.app-header {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
}

.app-header h1 {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  margin: 0 0 0.3rem;
  letter-spacing: 0.1rem;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.3vw, 1.1rem);
}

.app-layout {
  display: flex;
  gap: 2.5rem;
  justify-content: center;
  align-items: flex-start;
  padding: 0 2rem 2.5rem;
  width: min(1100px, 100%);
  margin: 0 auto;
  flex-wrap: wrap;
}

.board-section {
  flex: 1 1 420px;
  display: flex;
  justify-content: center;
}

#omok-board {
  width: min(92vmin, 620px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--board-bg);
  border-radius: 24px;
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: pointer;
}

.info-panel {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.8rem 1.8rem 2.2rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 40px rgba(40, 24, 5, 0.1);
}

.status {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-note + .status-note {
  margin-top: 0.2rem;
}

.difficulty-highlight {
  color: var(--accent);
  font-weight: 700;
}

.turn-display {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.difficulty {
  margin: 0;
  padding: 1.1rem 1.25rem 1.3rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.difficulty legend {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.3rem;
  color: var(--text-main);
}

.difficulty-options {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.difficulty-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.difficulty-option input[type='radio'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.option-body {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.difficulty-option:hover .option-body {
  background: rgba(255, 255, 255, 0.78);
}

.option-name {
  display: block;
  font-weight: 600;
  color: var(--text-main);
}

.option-desc {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.difficulty-option input[type='radio']:checked + .option-body {
  border-color: rgba(255, 107, 61, 0.55);
  background: rgba(255, 107, 61, 0.15);
  box-shadow: 0 10px 26px rgba(255, 107, 61, 0.18);
}

.difficulty-option input[type='radio']:checked + .option-body .option-name {
  color: var(--accent);
}

.difficulty-option input[type='radio']:checked + .option-body .option-desc {
  color: var(--text-main);
}

.difficulty-option input[type='radio']:focus-visible + .option-body {
  outline: 3px solid rgba(255, 107, 61, 0.35);
  outline-offset: 2px;
}

.difficulty-note {
  margin: 0.9rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.stone-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  display: inline-block;
}

.stone-icon.black {
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #404040 45%, #000000 100%);
}

.stone-icon.white {
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #ffffff 50%, #d2d2d2 100%);
}

.feedback {
  min-height: 1.2rem;
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.controls button {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 25px rgba(255, 107, 61, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.controls button:active {
  transform: translateY(1px);
  box-shadow: 0 8px 15px rgba(255, 107, 61, 0.3);
}

.controls button:focus-visible {
  outline: 3px solid rgba(255, 107, 61, 0.4);
  outline-offset: 2px;
}

.rules h2 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.rules ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  display: grid;
  gap: 0.45rem;
}

.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: rgba(60, 40, 15, 0.65);
  font-size: 0.9rem;
}

@media (max-width: 960px) {
  .app-layout {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem 2.5rem;
  }

  .info-panel {
    width: min(460px, 100%);
  }

  #omok-board {
    width: min(92vw, 560px);
  }
}

@media (max-width: 540px) {
  .info-panel {
    padding: 1.5rem;
    gap: 1.25rem;
  }

  .controls button {
    padding: 0.8rem 1rem;
  }
}
