@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-main: #09090f;
  --bg-secondary: #11111b;
  --card-bg: rgba(19, 21, 33, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  --soft-border: rgba(255, 255, 255, 0.06);

  --text-main: #f5f7ff;
  --text-soft: #b6bfd6;
  --text-muted: #8f98b2;

  --accent: #7c5cff;
  --accent-2: #31cfff;
  --accent-3: #8effc1;

  --danger: #ff5f7a;

  --shadow-main: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.25);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}
body {
  background:
    radial-gradient(
      circle at top left,
      rgba(124, 92, 255, 0.18),
      transparent 28%
    ),
    radial-gradient(
      circle at top right,
      rgba(49, 207, 255, 0.14),
      transparent 25%
    ),
    radial-gradient(
      circle at bottom center,
      rgba(142, 255, 193, 0.08),
      transparent 30%
    ),
    linear-gradient(145deg, #07070c 0%, #0d0e17 50%, #101321 100%);
  display: flex;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.app {
  width: 100%;
  max-width: 1180px;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 28px;
  align-items: stretch;
}
.hero-card,
.history-card {
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-main);
  backdrop-filter: blur(18px);
}
.hero-card {
  padding: 34px;
  min-height: 680px;
  justify-content: space-between;
  display: flex;
  flex-direction: column;
}
.hero-card::before,
.history-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04),
    transparent 28%,
    transparent 72%,
    rgba(255, 255, 255, 0.02)
  );
  pointer-events: none;
}
.hero-top {
  position: relative;
  z-index: 2;
}
.tag {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(49, 207, 255, 0.08);
  border: 1px solid rgba(49, 207, 255, 0.14);
  padding: 10px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero-top h1 {
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 1.02;
  margin-bottom: 16px;
  letter-spacing: -0.04em;
}
.hero-top h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.description {
  max-width: 650px;
  color: var(--text-soft);
  font-size: 1.03em;
  line-height: 1.75;
}

.dice-panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 24px;
  align-items: center;
  margin: 32px 0;
  padding: 22px;
  border: 1px solid var(--soft-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.015)
  );
}
.dice-visual-wrap {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(
      circle at center,
      rgba(124, 92, 255, 0.12),
      transparent 48%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02),
      rgba(255, 255, 255, 0.01)
    );
  border: 1px solid var(--soft-border);
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(35px);
  opacity: 0.65;
}
.glow-1 {
  width: 120px;
  height: 120px;
  background: rgba(124, 92, 255, 0.4);
  top: 18%;
  left: 20%;
}
.glow-2 {
  width: 130px;
  height: 130px;
  background: rgba(49, 207, 255, 0.28);
  bottom: 14%;
  right: 18%;
}
.dice-box {
  position: relative;
  z-index: 2;
  width: 190px;
  height: 190px;
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.18),
      rgba(255, 255, 255, 0.04)
    ),
    linear-gradient(180deg, #161b2d, #0f1322);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 16px 40px rgba(0, 0, 0, 0.35);
}
.dice-emoji {
  font-size: 5.5em;
  line-height: 1;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.25));
}
.result-box {
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--soft-border);
  background: linear-gradient(
    180deg,
    rgba(124, 92, 255, 0.07),
    rgba(49, 207, 255, 0.03)
  );
}
.result-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78em;
  font-weight: bold;
  margin-bottom: 12px;
}
.result-number {
  font-size: clamp(4rem, 9vw, 5.8rem);
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -0.06em;
}
.result-hint {
  font-size: 0.96em;
  color: var(--text-soft);
  line-height: 1.7;
}
.actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.98em;
  padding: 16px 24px;
  border-radius: 16px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease,
    background 0.2s ease;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 30px rgba(124, 92, 255, 0.24);
}
.btn-secondary {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--soft-border);
  box-shadow: var(--shadow-soft);
}
.history-card {
  padding: 28px;
  min-height: 680px;
  display: flex;
  flex-direction: column;
}
.history-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--soft-border);
  margin-bottom: 22px;
}
.history-mini {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72em;
  font-weight: 700;
  margin-bottom: 8px;
}
.history-header h3 {
  font-size: 1.5em;
  letter-spacing: -0.03em;
}
.history-counter {
  white-space: nowrap;
  font-size: 0.9em;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(49, 207, 255, 0.08);
  border: 1px solid rgba(49, 207, 255, 0.14);
  padding: 10px 14px;
  border-radius: 999px;
}
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 4px 5px 5px 4px;
}
.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--soft-border);
  background: rgba(255, 255, 255, 0.025);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border 0.2s ease;
}
.history-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.history-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.history-roll-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.4em;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.15),
    rgba(49, 207, 255, 0.1)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.history-roll-info p:first-child {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 5px;
}
.history-roll-info p:last-child {
  color: var(--text-muted);
  font-size: 0.88em;
}
.history-value {
  min-width: 48px;
  text-align: center;
  font-size: 1.25em;
  font-weight: 800;
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.empty-state {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}
.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.4em;
  background: rgba(255, 255, 255, 0.04);
}
.empty-title {
  font-weight: 700;
  margin-bottom: 5px;
}
.empty-text {
  color: var(--text-muted);
  font-size: 0.92em;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .history-card {
    min-height: auto;
  }
  .dice-panel {
    grid-template-columns: 1fr;
  }
  .dice-visual-wrap {
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 18px;
  }

  .hero-card,
  .history-card {
    padding: 22px;
    border-radius: 22px;
  }

  .dice-box {
    width: 150px;
    height: 150px;
  }

  .dice-emoji {
    font-size: 4.5rem;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.roll-animation {
  animation: diceRoll 0.45s ease;
}

@keyframes diceRoll {
  0% {
    transform: rotate(0deg) scale(1);
  }
  30% {
    transform: rotate(120deg) scale(1.08);
  }
  60% {
    transform: rotate(240deg) scale(1.14);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}
