/* Yatzy.com browser game. Plain CSS, no build step. */

.yatzy_game {
  --yg-green: #39a936;
  --yg-green-dark: #2b8a29;
  --yg-green-soft: #eaf5e4;
  --yg-ink: #222;
  --yg-muted: #7a7a7a;
  --yg-line: #e6e6e6;
  width: 100%;
  max-width: 600px;
  margin: 24px auto 8px;
  position: relative;
  font-family: "Inter", Metropolis, sans-serif;
  color: var(--yg-ink);
  text-align: left;
}

.yatzy_game * {
  box-sizing: border-box;
}

.yg-panel {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(34, 34, 34, 0.12);
  border: 1px solid #eee;
  padding: 20px;
}

.yg-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Buttons */
.yg-btn {
  appearance: none;
  border: 2px solid var(--yg-green);
  background: #fff;
  color: var(--yg-green-dark);
  border-radius: 999px;
  padding: 10px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.yg-btn:hover:not(:disabled) {
  background: var(--yg-green-soft);
}

.yg-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.yg-btn-primary {
  background: var(--yg-green);
  color: #fff;
}

.yg-btn-primary:hover:not(:disabled) {
  background: var(--yg-green-dark);
}

.yg-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.yg-link-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--yg-green-dark);
  text-decoration: underline;
  cursor: pointer;
}

.yatzy_game button:focus-visible,
.yatzy_game input:focus-visible,
.yatzy_game select:focus-visible {
  outline: 3px solid #f18500;
  outline-offset: 2px;
}

/* Setup */
.yg-setup fieldset {
  border: 0;
  margin: 0 0 18px;
  padding: 0;
  min-width: 0;
}

.yg-setup legend {
  border: 0;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--yg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.yg-segs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yg-seg {
  margin: 0;
  font-weight: 600;
}

.yg-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.yg-seg span {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid var(--yg-line);
  cursor: pointer;
  font-size: 15px;
}

.yg-seg input:checked + span {
  background: var(--yg-green);
  border-color: var(--yg-green);
  color: #fff;
}

.yg-seg input:focus-visible + span {
  outline: 3px solid #f18500;
  outline-offset: 2px;
}

.yg-small {
  margin: 8px 0 0;
  font-size: 14px;
}

.yg-small a {
  color: var(--yg-green-dark);
}

.yg-players {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.yg-player-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.yg-player-row input,
.yg-player-row select {
  height: 42px;
  border: 2px solid var(--yg-line);
  border-radius: 10px;
  padding: 0 10px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}

.yg-player-row input {
  flex: 1;
  min-width: 0;
}

.yg-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f2f2f2;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.yg-start {
  width: 100%;
  font-size: 18px;
  padding: 14px;
}

/* Play area */
.yg-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.yg-ruleset {
  font-size: 13px;
  font-weight: 700;
  color: var(--yg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.yg-status {
  min-height: 24px;
  margin: 8px 0 14px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.yg-dice {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.yg-die {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  width: 64px;
  height: 64px;
  cursor: pointer;
  border-radius: 14px;
  transition: transform 0.15s;
}

.yg-dice-6 .yg-die {
  width: 54px;
  height: 54px;
}

.yg-die:disabled {
  cursor: default;
}

.yg-die svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.18));
}

.yg-die-face {
  fill: #fff;
  stroke: #d6d6d6;
  stroke-width: 3;
}

.yg-pips {
  fill: #222;
}

.yg-die.is-blank .yg-pips {
  opacity: 0.12;
}

.yg-die.is-held {
  transform: translateY(-6px);
}

.yg-die.is-held .yg-die-face {
  fill: var(--yg-green-soft);
  stroke: var(--yg-green);
  stroke-width: 6;
}

.yg-die.is-rolling svg {
  animation: yg-roll 0.45s ease-out;
}

@keyframes yg-roll {
  0% { transform: rotate(0) scale(0.9); }
  40% { transform: rotate(-25deg) scale(1.05); }
  70% { transform: rotate(15deg) scale(0.97); }
  100% { transform: rotate(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .yg-die.is-rolling svg {
    animation: none;
  }

  .yg-die {
    transition: none;
  }
}

.yg-roll {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 18px;
  font-size: 18px;
  padding: 12px;
}

/* Scorecard */
.yg-card-wrap {
  overflow-x: auto;
}

.yg-card {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.yg-card th,
.yg-card td {
  border-bottom: 1px solid var(--yg-line);
  padding: 0;
  height: 36px;
  text-align: center;
}

.yg-card thead th {
  font-size: 13px;
  font-weight: 700;
  padding: 4px;
  max-width: 90px;
  vertical-align: bottom;
}

.yg-pname {
  display: inline-block;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.yg-bot {
  margin-left: 2px;
  font-size: 12px;
}

.yg-card .yg-box-col {
  text-align: left;
  font-weight: 600;
  padding-left: 4px;
  white-space: nowrap;
}

.yg-card .is-current {
  background: var(--yg-green-soft);
}

.yg-card thead th.is-current {
  color: var(--yg-green-dark);
  border-radius: 8px 8px 0 0;
}

.yg-val {
  font-weight: 700;
}

.yg-val.is-zero {
  color: var(--yg-muted);
  font-weight: 400;
}

.yg-card td.is-fresh .yg-val {
  color: var(--yg-green-dark);
}

.yg-pick {
  appearance: none;
  width: 100%;
  height: 100%;
  min-height: 36px;
  border: 0;
  background: none;
  font: inherit;
  color: var(--yg-green-dark);
  font-style: italic;
  cursor: pointer;
}

.yg-pick:hover,
.yg-pick:focus-visible {
  background: var(--yg-green);
  color: #fff;
  font-style: normal;
  font-weight: 700;
}

.yg-pick.is-zero {
  color: #b5b5b5;
}

.yg-sum th,
.yg-sum td {
  background: #fafafa;
  font-size: 14px;
}

.yg-sum .is-current {
  background: #e1efda;
}

.yg-par-hint {
  font-weight: 400;
  color: var(--yg-muted);
  font-size: 12px;
}

.yg-par {
  font-size: 12px;
  font-weight: 700;
}

.yg-par.is-up {
  color: var(--yg-green-dark);
}

.yg-par.is-down {
  color: #d0542c;
}

.yg-need {
  font-size: 12px;
  color: var(--yg-muted);
}

.yg-total th,
.yg-total td {
  font-size: 17px;
  border-bottom: 0;
  height: 44px;
}

/* Game over */
.yg-over {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.yg-over-box {
  position: sticky;
  top: 20px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(34, 34, 34, 0.25);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.yg-trophy {
  font-size: 44px;
  margin: 0;
}

.yg-over-box h3 {
  margin: 6px 0 12px;
  font-size: 26px;
  font-weight: 800;
}

.yg-ranking {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: rank;
}

.yg-ranking li {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px solid var(--yg-line);
  counter-increment: rank;
}

.yg-ranking li span::before {
  content: counter(rank) ". ";
  color: var(--yg-muted);
}

.yg-over-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.yg-app {
  font-size: 14px;
  margin: 0 0 10px;
}

.yg-app a {
  color: var(--yg-green-dark);
  font-weight: 600;
}

.yg-socino {
  font-size: 12px;
  color: var(--yg-muted);
  margin: 0;
}

.yg-socino a {
  color: var(--yg-muted);
}

@media (max-width: 479px) {
  .yg-panel {
    padding: 14px 10px;
    border-radius: 16px;
  }

  .yg-die {
    width: 52px;
    height: 52px;
  }

  .yg-dice {
    gap: 7px;
  }

  .yg-dice-6 .yg-die {
    width: 44px;
    height: 44px;
  }

  .yg-card {
    font-size: 14px;
  }

  .yg-card .yg-box-col {
    font-size: 13px;
  }

  .yg-par-hint {
    display: none;
  }
}

/* Homepage "More games" grid has 7 games now. */
@media (min-width: 1441px) {
  .taugames {
    grid-template-columns: repeat(7, 1fr);
  }
}

.play_intro {
  max-width: 640px;
  text-align: center;
}

.app_prompt {
  margin-top: 28px;
  text-align: center;
}

.gallery_video {
  max-width: 900px;
  padding: 0 16px;
}
