/* Version 2: Advanced-only interface updates and refined responsive grid layout */
:root {
  --bg-dark: #0d1b2a;
  --bg-light: #1b263b;
  --accent: #e0a800;
  --accent-light: #f3d34a;
  --text-light: #f8f9fa;
  --text-muted: #a9bcd0;
  --card-bg: #1f4068;
  --card-selected: #3282b8;
  --success: #2ecc71;
  --warning: #ff9f1c;
  --danger: #e63946;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-light));
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header,
.app-footer {
  text-align: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.app-header h1 {
  margin: 0;
  font-size: 2.5rem;
  letter-spacing: 0.05em;
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

.app-main {
  flex: 1;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  grid-auto-flow: row;
  grid-gap: 1.5rem;
  align-items: start;
}

section {
  background: rgba(17, 27, 43, 0.9);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.mode-panel h2,
.scoreboard h2,
.board-wrapper h2,
.hands-section h2,
.action-panel h2,
.status-panel h2,
.rules-summary h2 {
  margin-top: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.1rem;
}

.mode-description {
  margin-bottom: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.mode-actions {
  display: flex;
  gap: 0.75rem;
}

button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.scoreboard .scores {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.score {
  flex: 1;
  background: rgba(14, 22, 33, 0.85);
  border-radius: 8px;
  padding: 0.75rem;
}

.marker {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.3rem;
}

.marker span {
  height: 16px;
  border-radius: 4px;
  background: rgba(248, 249, 250, 0.1);
}

.marker span.active {
  background: var(--accent-light);
}

.piste {
  display: grid;
  grid-template-columns: repeat(23, minmax(24px, 1fr));
  gap: 0.25rem;
  padding: 0.75rem;
  background: rgba(13, 27, 42, 0.85);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.piste .space {
  position: relative;
  padding-top: 100%;
  border-radius: 6px;
  background: rgba(248, 249, 250, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.space .index {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.6rem;
  color: rgba(248, 249, 250, 0.4);
}

.space .piece {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.space .piece.player-0 {
  background: var(--accent);
  color: #000;
}

.space .piece.player-1 {
  background: var(--accent-light);
  color: #000;
}

.hands-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  min-height: 80px;
}

.card {
  flex: 0 0 60px;
  height: 90px;
  background: var(--card-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid transparent;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

.card.selected {
  border-color: var(--card-selected);
  box-shadow: 0 0 0 2px rgba(50, 130, 184, 0.6);
}

.card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.action-message {
  min-height: 48px;
  background: rgba(248, 249, 250, 0.08);
  border-radius: 8px;
  padding: 0.75rem;
  font-weight: 500;
}

.action-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.action-options button.secondary {
  background: var(--card-bg);
  color: var(--text-light);
}

.log {
  max-height: 220px;
  overflow-y: auto;
  background: rgba(13, 23, 35, 0.85);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

.log-entry {
  font-size: 0.9rem;
  padding: 0.5rem;
  border-left: 3px solid var(--accent);
  background: rgba(248, 249, 250, 0.05);
}

.log-entry.success {
  border-color: var(--success);
}

.log-entry.warning {
  border-color: var(--warning);
}

.log-entry.danger {
  border-color: var(--danger);
}

.rules-summary details {
  background: rgba(12, 24, 36, 0.85);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.rules-summary summary {
  cursor: pointer;
  font-weight: 600;
}

.board-wrapper,
.hands-section {
  grid-column: 1 / -1;
}

@media (max-width: 960px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .mode-actions {
    flex-direction: column;
  }

  .card {
    flex-basis: calc(33% - 0.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
