* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #08111f;
  color: #f5f7ff;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

button { font: inherit; }

#game-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

#stage {
  position: relative;
  width: min(100vw, 66.6667vh, 640px);
  height: min(150vw, 100vh, 960px);
  overflow: hidden;
  background: #101b30;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

#game-canvas:focus-visible { outline: 3px solid #ffd56e; outline-offset: -5px; }

#control-strip {
  position: absolute;
  z-index: 2;
  right: 13px;
  bottom: 14px;
  left: 13px;
  min-height: 82px;
  padding: 10px;
  border: 1px solid rgba(198, 218, 255, .32);
  border-radius: 6px;
  background: rgba(8, 17, 31, .88);
  text-align: center;
}

#turn-label {
  min-height: 17px;
  margin: 0 0 7px;
  color: #dce9ff;
  font-size: 13px;
  font-weight: 700;
}

.control-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.roll, .utility, .primary, .secondary {
  min-height: 36px;
  border: 0;
  border-radius: 4px;
  font-weight: 800;
  cursor: pointer;
}

.roll, .primary { background: #ffd56e; color: #16223b; }
.roll { min-width: 148px; padding: 8px 18px; }
.roll:hover, .primary:hover { background: #ffe49b; }
.roll:disabled { cursor: not-allowed; opacity: .44; }
.utility { width: 36px; background: #24395c; color: #eff6ff; }
.utility:hover, .secondary:hover { background: #36537f; }

.panel {
  position: absolute;
  z-index: 4;
  top: 43%;
  left: 50%;
  width: min(430px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 24px;
  border: 1px solid rgba(255, 213, 110, .6);
  border-radius: 6px;
  background: rgba(11, 21, 39, .95);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .48);
  text-align: center;
}

.panel h1, .panel h2 { margin: 6px 0 12px; font-size: 30px; }
.panel p { margin: 8px 0; color: #d1ddf0; line-height: 1.48; }
.kicker { color: #ffd56e !important; font-size: 12px; font-weight: 800; letter-spacing: 1px; }
.controls-copy, .best-copy, .share-status { font-size: 13px; }
.primary { min-width: 128px; padding: 9px 16px; }
.secondary { min-width: 94px; padding: 9px 13px; background: #24395c; color: #eff6ff; }
.result-actions { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.share-status { margin: 10px 0 0 !important; color: #9ff4d7 !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
  #control-strip { right: 8px; bottom: 8px; left: 8px; min-height: 70px; padding: 7px; }
  #turn-label { margin-bottom: 5px; font-size: 11px; }
  .roll { min-width: 130px; min-height: 32px; padding: 7px 13px; font-size: 12px; }
  .utility { width: 32px; min-height: 32px; font-size: 11px; }
  .panel { padding: 18px; }
  .panel h1, .panel h2 { font-size: 24px; }
  .panel p { font-size: 13px; }
}
