/* Custom CSS Variables for Dynamic Theming */
:root {
  --theme-accent: #ff85a2; /* Defaulting to blossom colors */
  --theme-accent-dark: #c94f70;
  --theme-panel-border: #ffb3c6;
}

/* Base Styles & Typography */
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;
}

/* 3D Professional Wiggly Title */
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;
}

/* Layout */
.main-layout {
  display: flex;
  justify-content: center;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
}

/* Right Sidebar Wrapper */
.right-sidebar-wrapper {
  display: flex;
  flex-direction: column;
}

/* Sidebars */
.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;
}

.avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #555;
}

.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;
}

/* Center Game Console */
.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: 40px;
  transition: border-color 0.4s ease-in-out;
}

.roll-title {
  font-family: 'Lilita One', cursive;
  font-size: 28px;
  margin-top: 0;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.7);
}

.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 0px; 
  width: 100%;
  justify-content: center;
  align-items: center;
}

/* Dropdowns with custom double arrows */
select {
  flex: 1;
  min-width: 0;
  padding: 12px 40px 12px 14px; /* Extra padding on right so text doesn't hit arrows */
  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;
  
  /* Remove default browser arrow */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  
  /* Custom double arrow SVG */
  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;
}

/* Hide default arrow for older IE/Edge */
select::-ms-expand {
  display: none;
}

select:hover {
  background-color: #fafafa;
  transform: scale(1.03);
  box-shadow: 0 6px 0px rgba(0,0,0,0.3);
}

/* Animation Toggle Styles */
.anim-toggle-btn {
  padding: 8px 12px; 
  font-size: 15px; 
  font-weight: 400;
  font-family: 'Lilita One', cursive;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 0px rgba(0,0,0,0.3);
  letter-spacing: 1px;
  width: 100%; 
  margin-top: 15px;
  box-sizing: border-box;
}

.anim-on {
  background-color: #4CAF50;
  border: 3px solid #388E3C;
}

.anim-off {
  background-color: #F44336;
  border: 3px solid #D32F2F;
}

.anim-toggle-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 0px rgba(0,0,0,0.3);
  filter: brightness(1.1);
}

/* Dice Display */
.dice-display {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  align-items: center;
  min-height: 110px;
  margin-top: 35px;
  margin-bottom: 35px;
}

/* Main Dice Styling */
.die {
  width: 85px; 
  height: 85px; 
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 5px solid white;
  box-shadow: 0 6px 12px rgba(0,0,0,0.6);
}

.die-dot {
  width: 18px; 
  height: 18px; 
  background-color: white;
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

/* Roll Button */
.roll-btn {
  width: 100%;
  background-color: var(--theme-accent);
  color: white;
  border: none;
  padding: 15px;
  font-size: 32px;
  font-family: 'Lilita One', cursive;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0px #000, -3px -3px 0px #000, 3px -3px 0px #000, -3px 3px 0px #000, 0px 4px 0px rgba(0,0,0,0.5);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background-color 0.4s ease-in-out, filter 0.2s ease, opacity 0.2s;
  box-shadow: 0 6px 0 var(--theme-accent-dark), 0 10px 10px rgba(0,0,0,0.4);
}

.roll-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--theme-accent-dark), 0 4px 6px rgba(0,0,0,0.4);
}

.roll-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.roll-btn:hover:not(:disabled) {
  filter: brightness(1.15);
  animation: pulse 1.5s infinite;
}

/* Counters & Stats */
.counter-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: #3a3a3a;
  padding: 8px 15px;
  border-radius: 6px;
  box-sizing: border-box;
  font-weight: 700;
  margin-bottom: 20px;
  border: 1px solid #555;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.counter-side {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  color: #bbb;
}

.counter-side span {
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
  user-select: none;
}

.counter-side span:hover {
  color: #fff;
  transform: scale(1.1);
}

.counter-side span:active {
  transform: scale(0.95);
}

.counter-center {
  font-family: 'Lilita One', cursive;
  font-size: 36px;
  display: flex;
  align-items: center;
  text-shadow: 1px 1px 0 #000;
}

.streak-badge {
  background: linear-gradient(135deg, #444, #222);
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 20px;
  border: 1px solid #555;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.possible-colors {
  background: rgba(0,0,0,0.6);
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  margin-bottom: 20px;
  border: 1px solid #444;
}

.possible-colors span {
  font-weight: 700;
  text-shadow: 1px 1px 0 #000;
}

/* Inline History Section */
.history-section {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 8px;
  box-sizing: border-box;
  border: 1px solid #444;
}

.history-title {
  font-family: 'Lilita One', cursive;
  text-align: center;
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 22px;
  color: #fff;
  border-bottom: 2px dashed #666;
  padding-bottom: 10px;
  letter-spacing: 1px;
}

.inline-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-history {
  text-align: center;
  color: #aaa;
  padding: 10px 0;
  font-size: 15px;
  font-style: italic;
}

.history-row {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #333;
  transition: background 0.2s ease;
}

.history-row:hover {
  background: rgba(255,255,255,0.1);
}

.history-number {
  font-weight: 700;
  color: #aaa;
  min-width: 35px;
  font-size: 16px;
}

.history-dice-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-die {
  width: 25px;
  height: 25px;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.mini-dot {
  width: 5px;
  height: 5px;
  background-color: white;
  border-radius: 50%;
}

/* History Show More Button */
.history-toggle-btn {
  width: 100%;
  background-color: transparent;
  color: #aaa;
  border: 2px dashed #555;
  padding: 10px;
  margin-top: 15px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-toggle-btn:hover {
  background-color: rgba(255,255,255,0.1);
  color: white;
  border-color: #888;
}

.history-toggle-btn.hidden {
  display: none;
}

/* FULL-SCREEN ANIMATION OVERLAY STYLES */
.roll-overlay {
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100vw; 
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.roll-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-title {
  font-family: 'Lilita One', cursive;
  font-size: 54px;
  color: #fff;
  letter-spacing: 4px;
  margin-bottom: 50px;
  text-shadow: 0 4px 15px rgba(0,0,0,0.8);
  animation: pulse-text 0.6s infinite alternate;
}

@keyframes pulse-text {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.05); opacity: 1; color: var(--theme-accent); }
}

.overlay-dice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
  max-width: 90%;
}

.big-die {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  background-color: #666;
  border: 8px solid white;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.big-die-dot {
  width: 28px;
  height: 28px;
  background-color: white;
  border-radius: 50%;
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.5);
}

/* Subtle 0.5s Initial Shake */
.initial-shake {
  animation: micro-shake 0.5s ease-in-out 1 forwards;
}

@keyframes micro-shake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(3deg); }
  50% { transform: rotate(-3deg); }
  75% { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}