/* Custom CSS Variables for Dynamic Theming */
:root {
  --theme-accent: #ff85a2; 
  --theme-accent-dark: #c94f70;
  --theme-panel-border: #ffb3c6;
}

body {
  margin: 0;
  font-family: 'Fredoka', sans-serif;
  background-color: #000000;
  color: white;
  transition: background-image 0.4s ease-in-out;
  overflow-x: hidden;
}

header {
  text-align: center;
  padding: 30px 20px;
}

h1 {
  font-family: 'Lilita One', cursive;
  font-size: 64px;
  font-weight: 700;
  margin: 0;
  color: var(--theme-accent); 
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 
    0 2px 0 #333,
    0 4px 0 #222,
    0 6px 0 #111,
    0 8px 15px rgba(0, 0, 0, 0.9);
  animation: wiggle-3d 3s ease-in-out infinite;
  transition: color 0.4s ease-in-out;
}

@keyframes wiggle-3d {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25% { transform: rotate(-1.5deg) translateY(-3px); }
  75% { transform: rotate(1.5deg) translateY(3px); }
}

h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  margin: 5px 0 20px 0;
  letter-spacing: 1px;
}

.main-layout {
  display: flex;
  justify-content: center;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
}

.sidebar {
  width: 250px;
  background: rgba(30, 30, 30, 0.8);
  border: 2px solid var(--theme-panel-border);
  border-radius: 10px;
  padding: 10px;
  height: fit-content;
  transition: border-color 0.4s ease-in-out;
}

.sidebar h3 {
  font-family: 'Lilita One', cursive;
  text-align: center;
  font-size: 18px;
  margin-bottom: 15px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.streamer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.streamer-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.streamer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2a2a2a;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.streamer-card:hover {
  transform: translateY(-2px);
  background: #333;
}

.streamer-card > img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  object-fit: cover;
  background: #555;
}

.verify-badge {
  width: 17px !important;
  height: 17px !important;
  border-radius: 0 !important;
  margin-left: 4px;
  vertical-align: -3px;
  display: inline-block;
}

.streamer-card strong {
  color: var(--theme-accent);
  font-family: 'Lilita One', cursive;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.8);
  transition: color 0.4s ease-in-out;
}

.streamer-card span {
  color: #ccc;
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 13px;
}

.game-center {
  flex-grow: 1;
  max-width: 600px;
  background: rgba(20, 20, 20, 0.9);
  border: 2px solid var(--theme-panel-border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  transition: border-color 0.4s ease-in-out;
}

.roll-title {
  font-family: 'Marvin Regular', sans-serif !important;
  font-size: 32px !important;
  color: #FFFFFF !important;
  text-align: center !important;
  margin-top: 0 !important;
  margin-bottom: 15px !important;
  letter-spacing: 2px !important;
  text-transform: uppercase !important;
  font-weight: normal !important;
  text-shadow: 
    2px 2px 0 #555, 
    -2px -2px 0 #555, 
    2px -2px 0 #555, 
    -2px 2px 0 #555, 
    4px 4px 0 #111 !important;
}

.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 0px; 
  width: 100%;
  justify-content: center;
  align-items: center;
}

select {
  flex: 1;
  min-width: 0;
  padding: 12px 40px 12px 14px; 
  font-size: 15px;
  font-weight: 400;
  font-family: 'Lilita One', cursive;
  border-radius: 8px;
  border: 3px solid var(--theme-accent);
  background-color: #fff;
  color: #222;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 0px rgba(0,0,0,0.3);
  letter-spacing: 1px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M7 15l5 5 5-5'/%3e%3cpath d='M7 9l5-5 5 5'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

select:hover {
  background-color: #fafafa;
  transform: scale(1.03);
  box-shadow: 0 6px 0px rgba(0,0,0,0.3);
}

.dice-display {
  display: flex;
  flex-wrap: wrap;
  gap: 9px !important;
  justify-content: center;
  align-items: center;
  min-height: 110px;
  margin-top: 35px;
  margin-bottom: 35px;
}

.die {
  width: 90px !important; 
  height: 90px !important; 
  border-radius: 14px !important;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 8px solid white !important;
  box-sizing: border-box !important;
  box-shadow: 0 6px 12px rgba(0,0,0,0.6);
}

.die-dot {
  width: 16px !important; 
  height: 16px !important; 
  background-color: white !important;
  border-radius: 50% !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3) !important;
}

.overlay-dice-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 9px !important;
}

.roll-btn {
  width: 100% !important;
  background-color: #FFD700 !important;
  color: white !important;
  border: none !important;
  padding: 15px !important;
  font-size: 32px !important;
  font-family: 'Luckiest Guy', cursive !important;
  letter-spacing: 2px !important;
  text-shadow: 3px 3px 0px #FFA500, -3px -3px 0px #FFA500, 3px -3px 0px #FFA500, -3px 3px 0px #FFA500, 0px 4px 0px rgba(0,0,0,0.5) !important;
  border-radius: 8px !important;
  cursor: pointer;
  margin-bottom: 10px !important;
  transition: background-image 0.2s ease-in-out, opacity 0.2s !important;
  box-shadow: 0 6px 0 #D4AF37, 0 10px 10px rgba(0,0,0,0.4) !important;
  box-sizing: border-box !important;
  display: block;
}

.roll-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.roll-btn:hover:not(:disabled) {
  background-image: linear-gradient(to top, rgba(255, 255, 255, 0.4) 0%, transparent 50%) !important;
}

.stretch-text {
  display: inline-block;
  transform: scaleX(1.15);
  transform-origin: center;
}

.counter-row {
  display: flex;
  background-color: #2b2d31; 
  border-radius: 12px;
  justify-content: space-between;
  align-items: stretch; 
  color: white;
  font-family: 'Fredoka', sans-serif;
  margin: 12px 0 15px 0 !important; 
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden; 
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
  width: 100% !important; 
  box-sizing: border-box !important; 
}
.counter-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px; 
  font-size: 14px; 
  font-weight: bold;
  color: #b9bbbe;
  background-color: transparent; 
  padding: 15px 22px; 
  min-width: 60px;
}
.side-left {
  align-items: flex-start; 
}
.side-right {
  align-items: flex-end; 
}
.counter-side span { cursor: pointer; transition: color 0.1s, transform 0.1s;}
.counter-side span:hover { color: white; transform: scale(1.1); }
.counter-side span:active { transform: scale(0.95); }

.counter-center { 
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900; 
  font-size: 46px; 
  color: white; 
  flex: 1;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

.stats-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}
.stat-pill {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 12px;
  color: white;
  font-family: 'Fredoka', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}
.small-grey-text { color: #e0e0e0; font-size: 13px; font-weight: 500; font-family: 'Fredoka', sans-serif;}

.history-section {
  margin-top: 10px;
  width: 100%;
}
.history-title {
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  color: #e0e0e0;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
}
.inline-history-list {
  display: flex;
  flex-direction: column; 
  align-items: flex-start; 
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 12px;
}

.mini-die {
  width: 22px !important;
  height: 22px !important;
  border-radius: 5px !important;
  border: 2px solid #FFFFFF !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

.mini-die-dot {
  width: 4px !important;
  height: 4px !important;
  background-color: #FFFFFF !important;
  border-radius: 50% !important;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.1) !important;
}

.history-number {
  font-weight: 700;
  color: #aaa;
  width: 30px; 
  text-align: right; 
  margin-right: 8px;
  flex-shrink: 0;
  font-size: 16px;
  display: inline-block;
}

.info-square {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 15px;
  margin-top: 15px;
  text-align: center;
}
.info-square-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: 18px;
  color: #FFFFFF;
  margin-top: 0;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 1px;
}
.info-square-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  color: #FFFFFF;
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 10px 0;
}
.info-square-text:last-child {
  margin-bottom: 0;
}

.roll-overlay {
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100vw; 
  height: 100vh;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s ease;
  background-color: #000;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

.roll-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-title {
  font-family: 'Marvin Regular', sans-serif;
  font-size: 36px; 
  color: #FFFFFF;
  letter-spacing: 2px;
  margin-bottom: 18px; 
  font-weight: normal !important;
  text-shadow: 
    2px 2px 0 #555, 
    -2px -2px 0 #555, 
    2px -2px 0 #555, 
    -2px 2px 0 #555, 
    4px 4px 0 #111;
}

.overlay-dice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 9px !important;
  justify-content: center;
  max-width: 90%;
}

@keyframes diceShake {
  0% { transform: translate(0, 0) rotate(0deg); }
  12% { transform: translate(-3px, 2px) rotate(-2deg); }
  25% { transform: translate(3px, -3px) rotate(2deg); }
  37% { transform: translate(-2px, -3px) rotate(-1deg); }
  50% { transform: translate(3px, 3px) rotate(2deg); }
  62% { transform: translate(-3px, -2px) rotate(-2deg); }
  75% { transform: translate(2px, 3px) rotate(1deg); }
  87% { transform: translate(-2px, 2px) rotate(-1deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

.initial-shake {
  animation: diceShake 0.6s ease-in-out 1 forwards !important; 
}

.big-die {
  width: 90px !important;
  height: 90px !important;
  border-radius: 16px !important;
  background-color: #E6E6E6 !important; 
  border: 8px solid white !important;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: none !important; 
  will-change: transform; 
  box-sizing: border-box !important; 
}

.big-die-dot {
  width: 16px !important;
  height: 16px !important;
  background-color: white !important;
  border-radius: 50% !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1) !important; 
}