:root {
  --bg: #eef2fb;
  --bg-2: #e0e8f7;
  --card: #ffffff;
  --card-2: #f5f7fd;
  --grid: #d7def0;
  --accent: #f9b572;
  --accent-2: #0b79d0;
  --text: #1b2a45;
  --muted: #4c5b73;
  --danger: #d8344f;
  --shadow: 0 14px 35px rgba(31, 54, 109, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: "Space Grotesk", "M PLUS Rounded 1c", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  position: relative;
}

a {
  color: inherit;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(11, 121, 208, 0.1), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(249, 181, 114, 0.2), transparent 35%),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-2) 100%);
  z-index: -2;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2rem;
  padding: 3rem clamp(1rem, 4vw, 3rem) 1rem;
  position: relative;
}

.hero__text h1 {
  margin: 0.2rem 0 0.8rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: 0.01em;
}

.hero__text .lede {
  max-width: 640px;
  color: var(--muted);
  margin: 0 0 1.2rem;
}

.eyebrow {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: rgba(76, 215, 200, 0.12);
  color: var(--accent-2);
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.4rem;
  background: linear-gradient(120deg, var(--accent), #ffd9a3);
  border-radius: 999px;
  color: #1c1c1c;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.meta-chip {
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}


.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  align-content: center;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 0.9rem;
}

.stat__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat__value {
  font-size: 1.2rem;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 1.2rem;
  padding: 1rem clamp(1rem, 4vw, 3rem) 3rem;
  align-items: start;
}

.card {
  background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%);
  border-radius: 18px;
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
  position: relative;
}

.board-card {
  overflow: hidden;
}

.board__header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.level-switch {
  display: inline-flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.level-switch button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.level-switch button.active {
  background: linear-gradient(120deg, rgba(249, 181, 114, 0.15), rgba(76, 215, 200, 0.15));
  color: var(--text);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.puzzle-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.35rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.puzzle-picker label {
  font-size: 0.9rem;
  color: var(--muted);
}

select {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
}

.board__meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.8rem 0;
}

.pill {
  padding: 0.5rem 0.8rem;
  background: rgba(76, 215, 200, 0.12);
  color: var(--accent-2);
  border-radius: 999px;
  border: 1px solid rgba(76, 215, 200, 0.3);
  font-weight: 600;
}

.pill--muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.board {
  display: grid;
  grid-template-columns: repeat(9, minmax(32px, 1fr));
  gap: 2px;
  background: var(--grid);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #c6cee0;
  max-width: 620px;
  margin: 0 auto;
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #fdfefe;
  border: 1px solid #e2e6f1;
}

.cell input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: #12203b;
  text-align: center;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  font-weight: 700;
  outline: none;
  caret-color: var(--accent);
}

.cell.fixed input {
  color: #60708f;
}

.cell.selected {
  background: rgba(11, 121, 208, 0.12);
}

.cell.conflict {
  background: rgba(216, 52, 79, 0.15);
  border-color: rgba(216, 52, 79, 0.45);
}

.cell.highlight {
  background: rgba(249, 181, 114, 0.2);
}

.cell.hinted {
  background: rgba(11, 121, 208, 0.1);
  border-color: rgba(11, 121, 208, 0.3);
}
.cell.hinted input {
  color: #0b79d0;
  font-weight: 800;
}

.board::before,
.board::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.board .cell:nth-child(3n) {
  border-right-width: 2px;
  border-right-color: rgba(255, 255, 255, 0.08);
}

.board .cell:nth-child(9n + 1) {
  border-left-width: 2px;
  border-left-color: rgba(255, 255, 255, 0.08);
}

.board .cell:nth-child(n + 19):nth-child(-n + 27),
.board .cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-width: 2px;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, max-content));
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: var(--accent);
}

.legend__dot--conflict {
  background: var(--danger);
}

.legend__dot--fixed {
  background: var(--muted);
}

.side-panel .panel__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.side-panel .spaced {
  justify-content: flex-start;
  gap: 0.6rem;
}

.label {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.time {
  font-size: 2.4rem;
  margin: 0.2rem 0;
  letter-spacing: 0.05em;
  color: #0b79d0;
}

.sub {
  color: var(--muted);
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

button {
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transition: transform 0.1s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: linear-gradient(120deg, var(--accent), #ffd9a3);
  color: #141414;
}

button.primary.soft {
  background: linear-gradient(120deg, rgba(249, 181, 114, 0.25), rgba(76, 215, 200, 0.25));
  color: var(--text);
}

button.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

button.danger {
  border: 1px solid rgba(255, 123, 123, 0.4);
  color: var(--danger);
}

.ranking {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  color: var(--text);
}

.ranking li {
  margin-bottom: 0.25rem;
}

.notes ul {
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.ad-card {
  display: grid;
  gap: 0.6rem;
}

.ad-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.tag {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 600;
}

.ad-slot {
  min-height: 110px;
  border: 2px dashed rgba(27, 42, 69, 0.15);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
}

.footer {
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .board {
    grid-template-columns: repeat(9, minmax(28px, 1fr));
  }
  .hero__meta {
    grid-template-columns: repeat(2, 1fr);
  }
  .puzzle-picker {
    width: 100%;
    justify-content: space-between;
  }
  .board__header {
    flex-direction: column;
    align-items: flex-start;
  }
  .actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}
