/* ========= Base Reset & Tokens ========= */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #393E46;
  --surface: #232931;
  --ink: #EEEEEE;
  --muted: #c7d3cf;

  --accent: #4ECCA3;
  --accent-2: #cff740;
  --danger: #ff3d00;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-1: 0 6px 18px rgba(0,0,0,.25);
  --shadow-2: 0 10px 24px rgba(0,0,0,.28);
  --space: clamp(12px, 2vw, 20px);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.4;
}

/* ========= Layout ========= */
.container {
  width: min(1100px, 92vw);
  margin-inline: auto;
  text-align: center;
  padding-inline: var(--space);
  padding-bottom: clamp(24px, 6vw, 56px);
}

/* Dice blocks sit side-by-side on wide screens,
   become flexible with fluid width, and stack on phones */
.dice {
  display: inline-block;
  vertical-align: top;
  margin: clamp(8px, 2vw, 16px);
  padding: 0;
  width: clamp(160px, 30vw, 280px);
  text-align: center;
}

/* ========= Typography ========= */
h1 {
  margin: clamp(8px, 2vw, 20px) 0;
  font-family: 'Lobster', cursive;
  text-shadow: 5px 0 #232931;
  font-size: clamp(2.2rem, 10vw, 6.5rem); /* fluid */
  color: var(--accent);
  line-height: 1.05;
}

h2 {
  margin: 0;
  padding: 0;
  font-size: clamp(1.25rem, 3.6vw, 2rem);
  font-family: 'Indie Flower', cursive;
}

p {
  margin: 0;
  padding: 0;
  font-size: clamp(1rem, 2.8vw, 1.75rem);
  color: var(--accent);
  font-family: 'Indie Flower', cursive;
}

.score{
  color: #ffffff;
  font-size: clamp(2rem, 8vw, 4rem);
  padding: 0;
  margin: 0;
  text-align: center;
  font-family: 'Indie Flower', cursive;
}

/* ========= Images ========= */
/* Keep your global img rule but make it flexible and centered */
img {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  height: auto;
  border-radius: 50%; /* your original circular look */
  box-shadow: var(--shadow-1);
}

/* Preserve your special image variants */
.img1 { background-color: yellow; }
.img2{
  background-color: rgb(255, 0, 174);
  -webkit-transform: scaleX(-1);
  -moz-transform: scaleX(-1);
  -o-transform: scaleX(-1);
  transform: scaleX(-1);
  filter: FlipH;
  -ms-filter: "FlipH";
}

/* ========= Header/Heading Block ========= */
.heading {
  display: flex;
  min-height: clamp(160px, 32vw, 300px); /* flexible instead of fixed */
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: clamp(8px, 2vw, 16px);
  text-align: center;
  font-size: 1.5rem;
  color: var(--accent);
  font-family: 'Indie Flower', cursive;
  margin-top: 0;
  padding: var(--space) 0;
}

/* ========= Buttons ========= */
.btn,
#reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: clamp(180px, 60vw, 300px); /* fluid width */
  block-size: 52px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
  box-shadow: var(--shadow-1);
  user-select: none;
}

.btn {
  background-color: var(--accent);
  color: #0f1418;
}
.btn:hover {
  transform: translateY(-1px);
  background-color: #6fe0c3; /* accessible hover */
  color: #000;
}
.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

#reset {
  background-color: var(--danger);
  color: #ffffff;
}
#reset:hover { background-color: #ff5722; }

/* Keyboard accessibility */
.btn:focus-visible,
#reset:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 12px;
}

/* ========= Footer ========= */
footer {
  background-color: transparent;
  color: var(--accent);
  text-align: center;
  font-family: 'Indie Flower', cursive;
  padding: 10px;
  width: 100%;
  margin-top: 20px;
}

a{
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}
a:hover { opacity: .85; }

/* ========= Motion Preferences ========= */
@media (prefers-reduced-motion: reduce) {
  .btn, #reset { transition: none; }
}

/* ========= Responsive Breakpoints ========= */

/* Tablet (≤ 991px) */
@media (max-width: 991.98px){
  .container { width: 94vw; }
  h1 { font-size: clamp(2rem, 9vw, 4.25rem); }
  .dice { width: clamp(160px, 40vw, 260px); }
}

/* Large Phones / Small Tablets (≤ 767px) */
@media (max-width: 767.98px){
  .dice { width: clamp(180px, 46vw, 300px); }
  .heading { min-height: auto; padding-top: 12px; padding-bottom: 12px; }
}

/* Phones (≤ 575px) — stack the dice and make buttons full width */
@media (max-width: 575.98px){
  .container { width: 96vw; }
  h1 { font-size: clamp(1.8rem, 12vw, 3rem); text-shadow: 3px 0 #232931; }
  .dice {
    display: block;
    width: min(380px, 88vw);
    margin-inline: auto;
  }
  .btn, #reset { inline-size: 100%; }
  img { max-width: 100%; }
}
