
:root {
  --bg: #11100e;
  --panel: #1d1a16;
  --panel-light: #29241d;
  --gold: #d7ae62;
  --gold-light: #f1d49a;
  --text: #f5f0e8;
  --muted: #a49b8d;
  --border: #393127;
  --green: #65b98b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
}

/* HEADER */

.header {
  height: 60px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
}

.brand-icon {
  font-size: 23px;
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 25px;
}

/* LAYOUT */

.container {
  width: min(100% - 32px, 520px);
  margin: auto;
}

.game-heading {
  text-align: center;
  padding: 32px 0 24px;
}

.eyebrow {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 3px;
  font-weight: bold;
}

.game-heading h1 {
  margin: 10px 0 5px;
  font-family: Georgia, serif;
  font-size: 36px;
}

.game-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ========================================
   WOODEN DICE BOWL
======================================== */

.dice-section {
  text-align: center;
}

.bowl {
  width: min(100%, 400px);
  aspect-ratio: 1.45;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background:
    radial-gradient(
      ellipse at 50% 30%,
      #9b7045 0%,
      #684329 45%,
      #392318 78%,
      #1d120c 100%
    );

  border: 9px solid #392317;

  box-shadow:
    inset 0 3px 5px #d6a36a,
    inset 0 -12px 18px #140b06,
    0 12px 28px #000b,
    0 3px 2px #a16e3d;
}

/* Wooden rim */

.bowl-rim {
  width: 91%;
  height: 83%;
  border-radius: 50%;
  padding: 10px;

  background:
    linear-gradient(
      145deg,
      #b17b47,
      #59351f 35%,
      #321d12 70%,
      #8c5b35
    );

  box-shadow:
    inset 0 3px 5px #d5a16b,
    inset 0 -5px 9px #160b05,
    0 2px 5px #160d08;
}

/* Inside of bowl */

.bowl-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;

  background:
    radial-gradient(
      ellipse at 48% 35%,
      #68452c 0%,
      #422a1a 55%,
      #25160e 100%
    );

  box-shadow:
    inset 0 8px 15px #1a0e08,
    inset 0 -3px 8px #a16c40;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: visible;
  position: relative;
}

/* Subtle light reflection */

.bowl-inner::before {
  content: "";
  position: absolute;
  width: 65%;
  height: 25%;
  top: 10%;
  left: 17%;
  border-radius: 50%;

  background: radial-gradient(
    ellipse,
    #c28b54,
    transparent 75%
  );

  opacity: .16;
  pointer-events: none;
}

.bowl-label {
  position: absolute;
  bottom: 12px;
  color: #e0bd91;
  font-size: 8px;
  letter-spacing: 3px;
  text-shadow: 0 2px 3px #000;
  z-index: 4;
}

/* ========================================
   REALISTIC DICE
======================================== */

.dice-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  position: relative;
  z-index: 2;
}

/* Dice body */

.dice {
  position: relative;
  flex: 0 0 62px;
  width: 62px;
  height: 62px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;

  padding: 9px;
  box-sizing: border-box;

  background: linear-gradient(
    145deg,
    #fffef8,
    #e5dfcf
  );

  border: 1px solid #c9c0ad;
  border-radius: 12px;

  box-shadow:
    inset 2px 2px 4px rgba(255,255,255,0.9),
    inset -3px -3px 6px rgba(0,0,0,0.12),
    0 4px 8px rgba(0,0,0,0.25);
}

/* Dice bevel */

.dice::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  border: 1px solid #ffffff80;
  pointer-events: none;
  z-index: 2;
}

/* Dice pips */

.dice-pip {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;

  border-radius: 50%;
  opacity: 0;
  transform: scale(.8);

  align-self: center;
  justify-self: center;
}

.dice-pip.active {
  opacity: 1;
  transform: scale(1);
}

/* Black pips */

.dice-pip.black {
  background: radial-gradient(
    circle at 35% 30%,
    #555 0%,
    #171717 45%,
    #050505 100%
  );

  box-shadow:
    inset 1px 1px 2px #000,
    0 1px 1px #ffffff70;
}

/* Red pip (one) */

.dice-pip.red {
  background: radial-gradient(
    circle at 35% 30%,
    #ff7770 0%,
    #c51f18 45%,
    #740b08 100%
  );

  box-shadow:
    inset 1px 1px 2px #650000,
    0 1px 1px #ffffff70;
}

/* Dice roll animation */

.rolling .dice {
  animation: dice-roll .18s infinite alternate;
}

@keyframes dice-roll {
  0% {
    transform: translateY(-5px) rotate(-12deg);
  }

  50% {
    transform: translateY(3px) rotate(10deg);
  }

  100% {
    transform: translateY(-3px) rotate(18deg);
  }
}
/* ========================================
   RESULT
======================================== */

.result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 20px 0 28px;
}

.result-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 2px;
}

#resultText {
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: bold;
  color: var(--gold-light);
}

/* ========================================
   CONTROLS
======================================== */

.control-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}

.step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: #3b3021;
  border-radius: 9px;
  color: var(--gold);
  font-weight: bold;
}

.step-heading h2 {
  margin: 0;
  font-size: 15px;
}

.step-heading p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

/* GAUGE */

.timing-gauge {
  height: 28px;
  position: relative;
  border-radius: 8px;

  background:
    linear-gradient(
      90deg,
      #805c38,
      #d4a75b,
      #805c38
    );

  margin: 25px 0;
  overflow: hidden;
}

.gauge-center {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 3px;
  background: white;
  box-shadow: 0 0 8px white;
  z-index: 2;
}

.gauge-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 100%;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 0 10px white;
  z-index: 3;
}

/* BUTTONS */

.main-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 10px;

  background:
    linear-gradient(135deg, #e4c17e, #b88a43);

  color: #21170d;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
  box-shadow: 0 4px 12px #0005;
}

.main-button:active {
  transform: scale(.98);
}

.strength-section {
  margin-top: 28px;
}

.power-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin: 20px 0 12px;
}

.power-labels strong {
  font-size: 17px;
  color: var(--gold-light);
}

.secondary-button {
  width: 100%;
  min-height: 46px;
  margin-top: 15px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 10px;
  font-weight: bold;
}

/* ========================================
   HISTORY
======================================== */

.history-section {
  margin: 30px 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.section-title h2 {
  font-size: 17px;
  margin: 0;
}

.text-button {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px;
  font-size: 13px;
}

.history-result {
  color: var(--gold-light);
  font-weight: bold;
}

.history-dice {
  color: var(--muted);
  font-size: 12px;
}

.empty-history {
  text-align: center;
  color: var(--muted);
  padding: 25px;
  font-size: 12px;
}

/* FOOTER */

footer {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 2px;
}

/* ========================================
   MODALS
======================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000b;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: min(100%, 420px);
  max-height: 85vh;
  overflow-y: auto;
  background: #211d18;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.close-button {
  border: 0;
  background: none;
  color: var(--text);
  font-size: 28px;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 10px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  text-align: left;
}

.rules-content h3 {
  color: var(--gold);
  font-size: 14px;
  margin-top: 22px;
}

.rules-content p,
.rules-content li {
  color: #c4bbaf;
  font-size: 13px;
  line-height: 1.7;
}

.rules-content ul {
  padding-left: 20px;
}

.rules-note {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

/* UTILITY */

.hidden {
  display: none !important;
}

/* MOBILE */

@media (max-width: 380px) {
  .dice {
    width: 53px;
    height: 53px;
    padding: 8px;
    gap: 2px;
  }

  .dice-container {
    gap: 9px;
  }

  .container {
    width: calc(100% - 24px);
  }
}


/* ========================================
   CHERRY BLOSSOM PETALS
======================================== */

#sakuraContainer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 20;
}

.sakura-petal {
  position: absolute;
  top: -30px;
  left: 0;

  width: 12px;
  height: 16px;

  background:
    radial-gradient(
      ellipse at 35% 30%,
      #fff0f5 0%,
      #ffc6d8 45%,
      #ed8eae 100%
    );

  border-radius: 80% 10% 80% 10%;

  opacity: 0.8;

  animation:
    sakura-fall linear infinite,
    sakura-sway ease-in-out infinite;

  will-change: transform;
}

@keyframes sakura-fall {
  from {
    transform: translateY(-30px) rotate(0deg);
  }

  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

@keyframes sakura-sway {
  0%, 100% {
    margin-left: -25px;
  }

  50% {
    margin-left: 25px;
  }
}
