:root {
    --bg: #e7dfc8;
    --panel: #efe6cf;
    --panel-soft: #f6eed8;
    --gold: #d5b13a;
    --gold-hover: #c59d24;
    --brown: #9a6b46;
    --brown-dark: #5b3a21;
    --text: #1f140d;
    --shadow: rgba(80, 50, 20, 0.18);
    --header-h: 82px;
    --footer-h: 52px;
  }
  
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html,
  body {
    height: 100%;
  }
  
  body {
    background: var(--bg);
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .site-header {
    height: var(--header-h);
    background: var(--panel);
    border-bottom: 2px solid var(--brown);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 20px;
    flex-shrink: 0;
  }
  
  .header-left h1 {
    font-size: 1.7rem;
    margin-bottom: 2px;
    line-height: 1.1;
  }
  
  .header-left p {
    color: var(--brown-dark);
    font-size: 0.95rem;
  }
  
  .home-btn {
    display: inline-block;
    background: var(--gold);
    color: var(--text);
    text-decoration: none;
    font-weight: bold;
    padding: 10px 14px;
    border: 2px solid var(--brown);
    border-radius: 12px;
    transition: 0.2s ease;
    box-shadow: 0 2px 6px var(--shadow);
    white-space: nowrap;
  }
  
  .home-btn:hover {
    background: var(--gold-hover);
  }
  
  .page-layout {
    width: min(1450px, 96%);
    margin: 10px auto;
    display: grid;
    grid-template-columns: minmax(900px, 1fr) 290px;
    gap: 16px;
    flex: 1;
    min-height: 0;
    height: calc(100vh - var(--header-h) - var(--footer-h) - 20px);
  }
  
  .game-panel,
  .sidebar-card {
    background: var(--panel);
    border: 2px solid var(--brown);
    border-radius: 18px;
    box-shadow: 0 8px 18px var(--shadow);
  }
  
  .game-panel {
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  
  .game-panel-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
  }
  
  .game-title-block {
    text-align: center;
  }
  
  .game-title-block h2 {
    font-size: 1.45rem;
    color: var(--brown-dark);
    margin-bottom: 4px;
  }
  
  .game-title-block p {
    font-size: 0.92rem;
    line-height: 1.3;
  }
  
  .top-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .top-controls button {
    background: var(--gold);
    color: var(--text);
    border: 2px solid var(--brown);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: 0.2s ease;
  }
  
  .top-controls button:hover {
    background: var(--gold-hover);
    transform: translateY(-1px);
  }
  
  .top-help {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.88rem;
    text-align: center;
  }
  
  .game-main-row {
    display: grid;
    grid-template-columns: 600px 1fr;
    gap: 16px;
    align-items: start;
    justify-content: center;
    min-height: 0;
  }
  
  .game-board-col {
    display: flex;
    justify-content: center;
  }
  
  .canvas-wrapper {
    width: 600px;
    height: 600px;
    flex-shrink: 0;
  }
  
  #gameCanvas {
    display: block;
    width: 600px;
    height: 600px;
    background: #d8c9a0;
    border: 3px solid var(--brown);
    border-radius: 14px;
    box-shadow: inset 0 0 0 2px rgba(90, 60, 25, 0.08);
  }
  
  .game-side-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 220px;
  }
  
  .info-box,
  .message-box {
    background: var(--panel-soft);
    border: 2px solid var(--brown);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 3px 8px var(--shadow);
  }
  
  .info-label {
    display: block;
    font-weight: bold;
    color: var(--brown-dark);
    margin-bottom: 6px;
    font-size: 0.95rem;
  }
  
  .message {
    font-size: 0.92rem;
    line-height: 1.35;
    color: var(--brown-dark);
  }
  
  .sidebar {
    min-height: 0;
  }
  
  .sidebar-card {
    padding: 14px 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  
  .sidebar-card h3 {
    font-size: 1.3rem;
    color: var(--brown-dark);
    margin-bottom: 4px;
  }
  
  .sidebar-subtitle {
    font-size: 0.88rem;
    margin-bottom: 10px;
  }
  
  .leaderboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 2px;
  }
  
  .leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--panel-soft);
    border: 2px solid var(--brown);
    border-radius: 12px;
    padding: 9px 8px;
  }
  
  .player-row {
    border-color: var(--gold-hover);
    box-shadow: 0 0 0 2px rgba(213, 177, 58, 0.18);
  }
  
  .leader-left {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }
  
  .leader-rank {
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    font-size: 0.9rem;
  }
  
  .leader-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
  }
  
  .leader-name {
    font-weight: bold;
    color: var(--brown-dark);
    font-size: 0.92rem;
  }
  
  .leader-state {
    font-size: 0.8rem;
    color: #6b4d33;
  }
  
  .leader-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.84rem;
    white-space: nowrap;
  }
  
  .site-footer {
    height: var(--footer-h);
    background: var(--panel);
    border-top: 2px solid var(--brown);
    text-align: center;
    padding: 14px 10px;
    color: var(--brown-dark);
    flex-shrink: 0;
  }
  
  @media (max-width: 1320px) {
    body {
      overflow: auto;
    }
  
    .page-layout {
      grid-template-columns: 1fr;
      height: auto;
    }
  
    .game-main-row {
      grid-template-columns: 1fr;
    }
  
    .game-board-col {
      justify-content: center;
    }
  
    .canvas-wrapper,
    #gameCanvas {
      width: min(100%, 600px);
      height: auto;
      aspect-ratio: 1 / 1;
    }
  }
  
  @media (max-width: 760px) {
    body {
      overflow: auto;
    }
  
    .site-header {
      height: auto;
      flex-direction: column;
      text-align: center;
      padding: 12px;
    }
  
    .header-left h1 {
      font-size: 1.45rem;
    }
  
    .game-title-block h2 {
      font-size: 1.25rem;
    }
  
    .top-help {
      flex-direction: column;
      gap: 6px;
    }
  
    .site-footer {
      height: auto;
    }
  }