/* Tic Tac Toe Extrem - Layout & responsive Skalierung
   Das Canvas hat eine feste interne Aufloesung von 1920x1080.
   #stage zentriert es und JS skaliert es passend zur Fenstergroesse (16:9). */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #241409;            /* dunkles Holz (Letterbox-Raender) */
  font-family: Georgia, "Times New Roman", serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  /* Tatsaechliche Anzeigegroesse wird per JS gesetzt (Viewport.js) */
  display: block;
  background: #241409;
}

/* --- Overlays (Namenseingabe / Ergebnis / Online) im Holz-/Gold-Look --- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 10, 4, 0.72);
  z-index: 10;
  overflow-y: auto;
  padding: 16px;
}

.overlay.hidden {
  display: none;
}

.panel {
  background: linear-gradient(180deg, #7a4f2b 0%, #4a2d17 100%);
  border: 5px solid #cda24b;
  border-radius: 16px;
  padding: 40px 48px;
  min-width: min(360px, 88vw);
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  text-align: center;
  color: #f7df9f;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6),
              inset 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.panel h2 {
  font-size: 36px;
  font-weight: bold;
  color: #ffe9a8;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  margin-bottom: 24px;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 16px;
  color: #f7df9f;
  text-align: left;
}

.fields input {
  font-size: 20px;
  padding: 10px 12px;
  border: 3px solid #cda24b;
  border-radius: 6px;
  background: #f5e8c8;
  color: #2a1a0c;
  outline: none;
}

.buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-size: 20px;
  font-weight: bold;
  padding: 14px 26px;
  border: 3px solid #ffe9a8;
  border-radius: 8px;
  background: linear-gradient(180deg, #e0b85a 0%, #b5882f 100%);
  color: #2a1a0c;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.btn-ghost {
  background: linear-gradient(180deg, #6b4528 0%, #432a16 100%);
  color: #f7df9f;
  border-color: #cda24b;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.btn:hover { filter: brightness(1.08); }

/* Online-Overlay Zusatz */
.hint {
  margin: 18px 0;
  color: #d8b878;
  font-size: 15px;
}

.status {
  margin-top: 18px;
  font-size: 18px;
  color: #f7df9f;
  min-height: 24px;
}

/* Grosse, gut lesbare Code-Anzeige */
.code-box {
  font-size: 48px;
  font-weight: bold;
  letter-spacing: 8px;
  color: #ffe9a8;
  border: 4px dashed #cda24b;
  border-radius: 8px;
  padding: 14px 20px;
  margin: 14px 0;
  display: inline-block;
}

/* Hilfe-Text ("Wie spielt man?") */
.help-text {
  list-style: none;
  text-align: left;
  max-width: 540px;
  margin: 0 auto 26px;
  padding: 0;
}

.help-text li {
  color: #f3e4c3;
  font-size: 18px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.help-text b {
  color: #ffe9a8;
}

/* "Plop"-Animation fuer das Ergebnis-Popup */
.pop {
  animation: pop 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* --- Figuren-Auswahl & Schwierigkeit --- */
.figure-block {
  text-align: left;
}

.figure-label {
  display: block;
  font-size: 15px;
  color: #d8b878;
  margin-bottom: 8px;
}

.figure-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 168px;
  overflow-y: auto;
  padding: 4px;
}

.figure-opt {
  width: 64px;
  height: 64px;
  padding: 4px;
  border: 3px solid #cda24b;
  border-radius: 10px;
  background: #f5e8c8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, box-shadow 0.08s;
}

.figure-opt:hover { transform: translateY(-2px); }

.figure-opt.selected {
  border-color: #ffe9a8;
  box-shadow: 0 0 0 3px #c01818, 0 4px 10px rgba(0, 0, 0, 0.4);
}

.figure-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #2a1a0c;
  text-align: center;
  line-height: 1.05;
  overflow: hidden;
}

.figure-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.figure-thumb-letter {
  font-size: 34px;
  font-weight: bold;
  font-family: Georgia, "Times New Roman", serif;
}

.difficulty-row {
  display: flex;
  gap: 10px;
}

.diff-opt {
  flex: 1;
  font-size: 17px;
  font-weight: bold;
  padding: 10px 6px;
  border: 3px solid #cda24b;
  border-radius: 8px;
  background: linear-gradient(180deg, #6b4528 0%, #432a16 100%);
  color: #f7df9f;
  cursor: pointer;
}

.diff-opt.selected {
  background: linear-gradient(180deg, #e0b85a 0%, #b5882f 100%);
  color: #2a1a0c;
  border-color: #ffe9a8;
}
