:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
  background: #008080;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 5vh 16px 32px;
  background: #008080;
}

button, select { font: inherit; }
button, a, select, input { touch-action: manipulation; }

.window {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 4px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 2px 2px 0 #000;
}

.title-bar {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  color: #fff;
  background: #000080;
}

.title-mark { font-size: 14px; }
.title-bar h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; }
.window-controls { display: flex; gap: 3px; }
.window-controls span {
  width: 20px;
  height: 19px;
  display: grid;
  place-items: center;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
}

.game-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 42px);
  padding: clamp(14px, 3vw, 28px);
  background: #c0c0c0;
}

.side-panel { width: 190px; flex: 0 0 190px; }
.score-card, .turn-card {
  margin-bottom: 14px;
  padding: 12px;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
}
.score-card h2 { margin: 0 0 12px; font-size: 16px; }
.score-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; margin: 8px 0; }
.score-row strong { min-width: 28px; text-align: right; font-size: 18px; }
.disc { width: 20px; height: 20px; display: inline-block; border-radius: 50%; }
.disc-black { background: #101010; border: 1px solid #000; box-shadow: inset 1px 1px 2px #555; }
.disc-white { background: #f4f4f4; border: 1px solid #666; box-shadow: inset 1px 1px 2px #fff; }
.panel-label { margin: 0 0 8px; color: #404040; font-size: 12px; text-transform: uppercase; }
.turn-indicator { display: flex; align-items: center; gap: 9px; }
.turn-indicator .disc { width: 24px; height: 24px; }
.game-message { min-height: 36px; margin: 10px 0 0; font-size: 13px; line-height: 1.35; }

.bevel-button {
  width: 100%;
  min-height: 40px;
  margin: 0 0 9px;
  padding: 7px 10px;
  color: #111;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  cursor: pointer;
}
.bevel-button:active { border-color: #404040 #fff #fff #404040; padding-top: 8px; padding-left: 11px; }
.bevel-button:focus-visible, .board-cell:focus-visible { outline: 2px dotted #000; outline-offset: -4px; }
.status-line { min-height: 16px; margin: 3px 0; font-size: 11px; }

.board-frame { width: min(560px, 66vw); flex: 0 1 560px; }
.coordinate-row {
  display: grid;
  grid-template-columns: 22px repeat(8, 1fr);
  height: 22px;
  align-items: center;
  color: #404040;
  text-align: center;
  font-size: 12px;
}
.board-with-coordinates { display: grid; grid-template-columns: 22px 1fr; }
.coordinate-column { display: grid; grid-template-rows: repeat(8, 1fr); align-items: center; color: #404040; text-align: center; font-size: 12px; }
.board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  padding: 3px;
  background: #087b23;
  border: 3px solid;
  border-color: #404040 #fff #fff #404040;
  box-shadow: inset 1px 1px 2px #00420e;
}
.board-cell {
  position: relative;
  min-width: 0;
  padding: 8%;
  display: grid;
  place-items: center;
  background: #087b23;
  border: 1px solid #034a14;
  cursor: pointer;
}
.board-cell:hover { background: #0a8e2a; }
.board-cell:disabled { cursor: default; }
.board-cell:disabled:hover { background: #087b23; }
.stone { position: relative; width: 90%; height: 90%; display: block; border-radius: 50%; transform-style: preserve-3d; }
.stone.black { transform: rotateY(0deg); }
.stone.white { transform: rotateY(180deg); }
.stone-side {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  box-shadow: 1px 2px 2px #00390d;
}
.black-face { background: radial-gradient(circle at 35% 30%, #4a4a4a, #111 56%, #000); }
.white-face { background: radial-gradient(circle at 35% 30%, #fff, #eee 58%, #bbb); border: 1px solid #777; transform: rotateY(180deg); }
.stone.flipping-to-white { animation: flip-to-white 550ms ease-in-out; }
.stone.flipping-to-black { animation: flip-to-black 550ms ease-in-out; }
@keyframes flip-to-white { from { transform: rotateY(0deg); } to { transform: rotateY(180deg); } }
@keyframes flip-to-black { from { transform: rotateY(180deg); } to { transform: rotateY(0deg); } }
.legal-marker {
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: rgba(255, 255, 180, .78);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.board-cell[aria-label*="Möglicher Zug"] { cursor: pointer; }
.status-bar {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding: 5px 7px;
  color: #333;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  font-size: 12px;
}
.status-bar span:nth-child(2) { flex: 1; }
.rules { width: min(900px, 100%); margin: 18px auto 0; padding: 0 8px; color: #fff; line-height: 1.5; }
.rules h2 { font-size: 16px; }
.rules p { max-width: 850px; font-size: 14px; }

dialog {
  width: min(430px, calc(100% - 24px));
  padding: 4px;
  color: #111;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .55);
}
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.dialog-title { display: flex; align-items: center; padding: 7px 9px; color: #fff; background: #000080; }
.dialog-title h2 { flex: 1; margin: 0; font-size: 15px; }
.close-button { width: 23px; height: 22px; padding: 0; font-size: 18px; line-height: 16px; background: #c0c0c0; border: 2px solid; border-color: #fff #404040 #404040 #fff; cursor: pointer; }
.dialog-content { padding: 14px 12px 6px; }
.dialog-content fieldset { display: grid; gap: 9px; margin: 0 0 15px; padding: 10px; border: 1px solid #808080; }
.dialog-content legend { padding: 0 4px; }
.dialog-content label { display: flex; align-items: center; gap: 7px; min-height: 24px; }
.dialog-content .hint-option { margin: 0 2px 10px; }
.dialog-content input { accent-color: #000080; }
.select-label { margin: 0 0 6px; }
.dialog-content select { width: 100%; min-height: 36px; padding: 5px; background: #fff; }
.dialog-content fieldset:disabled { color: #777; }
.dialog-note { margin: 12px 0 4px; color: #404040; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 10px 10px; }
.dialog-actions .bevel-button { width: auto; min-width: 100px; margin: 0; }
.primary-button { font-weight: 700; }

@media (max-width: 680px) {
  body { padding: 12px 8px 24px; }
  .game-layout { flex-direction: column-reverse; gap: 12px; padding: 12px 8px; }
  .board-frame { width: min(100%, 540px); flex: 0 1 auto; }
  .side-panel { width: min(100%, 540px); flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .score-card, .turn-card { margin-bottom: 0; }
  .side-panel > .bevel-button { grid-column: span 1; margin-bottom: 0; }
  .status-line { grid-column: 1 / -1; }
  .coordinate-row { height: 20px; grid-template-columns: 18px repeat(8, 1fr); }
  .board-with-coordinates { grid-template-columns: 18px 1fr; }
  .status-bar { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .stone.flipping-to-white, .stone.flipping-to-black { animation-duration: 0.01ms; }
}
