:root,
:root[data-theme="day"] {
  --page-bg:     #a9712f;
  --title:       #3a1d08;
  --wrap-bg:     #7a4a18;
  --wrap-border: #c8843a;
  --die-bg:      #f7f2ea;
  --die-text:    #2a1000;
  --die-border:  #8B4513;
  --btn-bg:      #8B4513;
  --btn-hover:   #a0521a;
  --btn-text:    #f5f0e8;
  --total:       #3a1d08;
  --status-text: #4a2c12;
  --status-bg:   rgba(255,255,255,0.28);
}

:root[data-theme="night"] {
  --page-bg:     #120e1c;
  --title:       #cfc6e6;
  --wrap-bg:     #1b1726;
  --wrap-border: #3a3252;
  --die-bg:      #2a2638;
  --die-text:    #ddd6ee;
  --die-border:  #4a4068;
  --btn-bg:      #3a3252;
  --btn-hover:   #4c4470;
  --btn-text:    #e6e0f5;
  --total:       #cfc6e6;
  --status-text: #b6aecf;
  --status-bg:   rgba(0,0,0,0.4);
}

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

body {
  background: var(--page-bg);
  transition: background 0.3s;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  font-family: sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 12px;
  width: 100%;
  max-width: 1200px;
}

#title {
  color: var(--title);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

#game-wrap {
  background: var(--wrap-bg);
  padding: 12px;
  border-radius: 8px;
  border: 3px solid var(--wrap-border);
  width: 100%;
  transition: background 0.3s, border-color 0.3s;
}

#board {
  display: block;
  width: 100%;
  height: auto;
}

#dice-area {
  display: flex;
  gap: 20px;
  align-items: center;
}

.die {
  width: 64px;
  height: 64px;
  background: var(--die-bg);
  color: var(--die-text);
  border-radius: 10px;
  border: 2px solid var(--die-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  cursor: pointer;
  transition: transform 0.1s, background 0.3s, border-color 0.3s, color 0.3s;
  user-select: none;
}

.die:active {
  transform: scale(0.92);
}

.die.rolling {
  animation: spin 0.4s ease;
}

@keyframes spin {
  0%   { transform: rotate(0deg)   scale(1.1); }
  50%  { transform: rotate(180deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1);   }
}

#roll-btn {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  transition: background 0.15s, transform 0.1s;
}

#roll-btn:hover  { background: var(--btn-hover); }
#roll-btn:active { transform: scale(0.97); }
#roll-btn:disabled { background: #555; opacity: 0.5; cursor: default; }

#total {
  font-size: 18px;
  font-weight: 600;
  color: var(--total);
}

#status {
  font-size: 14px;
  color: var(--status-text);
  background: var(--status-bg);
  padding: 6px 20px;
  border-radius: 20px;
  transition: background 0.3s, color 0.3s;
}

#theme-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  font-size: 22px;
  line-height: 1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: background 0.15s, transform 0.1s;
}

#theme-btn:hover  { background: var(--btn-hover); }
#theme-btn:active { transform: scale(0.92); }

#corner-label {
  position: fixed;
  top: 12px;
  left: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--title);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  user-select: none;
  z-index: 10;
}

/* На телефонах рисуем доску крупнее (150%) и разрешаем
   прокручивать её по горизонтали пальцем, чтобы кружки были читаемыми. */
@media (max-width: 600px) {
  #game-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #board {
    width: 300%;
    min-width: 300%;
  }
}
