/* ヨット固有スタイル */

.yt-panel {
  margin-top: 20px;
}

/* 終了表示 */
.yt-result {
  max-width: min(100%, 560px);
  margin: 0 auto 14px;
  padding: 18px;
  border: 1px solid rgba(150, 106, 255, 0.5);
  border-radius: var(--md-sys-shape-corner-large);
  background:
    radial-gradient(circle at 50% 0%, rgba(150, 106, 255, 0.24), transparent 70%),
    radial-gradient(circle at 85% 100%, rgba(63, 196, 255, 0.16), transparent 60%),
    linear-gradient(180deg, #16264a 0%, #101c38 100%);
  box-shadow: 0 0 26px rgba(150, 106, 255, 0.2);
  text-align: center;
  animation: yt-result-in 200ms ease-out;
}

.yt-result:focus {
  outline: none;
}

.yt-result__title {
  margin: 0;
  color: #e8f7ff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.yt-result__label {
  margin: 10px 0 0;
  color: rgba(190, 220, 255, 0.8);
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.yt-result__score {
  margin: 2px 0 0;
  color: #f4fbff;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  font-size: clamp(2.6rem, 11vw, 3.4rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(63, 196, 255, 0.45), 0 0 34px rgba(150, 106, 255, 0.3);
}

.yt-result__actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.yt-result__actions .btn {
  min-width: 10rem;
}

@keyframes yt-result-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ダイスエリア */
.yt-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(100%, 560px);
  margin: 0 auto 14px;
  padding: clamp(14px, 3vw, 20px) clamp(10px, 3vw, 20px);
  border: 1px solid rgba(96, 154, 214, 0.35);
  border-radius: var(--md-sys-shape-corner-large);
  background:
    radial-gradient(circle at 18% 0%, rgba(63, 196, 255, 0.14), transparent 62%),
    radial-gradient(circle at 86% 100%, rgba(150, 106, 255, 0.12), transparent 60%),
    linear-gradient(160deg, #16264a 0%, #101c38 55%, #0d1730 100%);
  box-shadow: 0 14px 34px rgba(28, 52, 96, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.yt-roll {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  color: #e8f7ff;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
}

.yt-roll__label {
  color: rgba(160, 235, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.yt-roll__value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(63, 196, 255, 0.3);
}

.yt-roll__rest {
  color: rgba(190, 220, 255, 0.75);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
}

.yt-dice {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 72px));
  justify-content: center;
  gap: clamp(6px, 2vw, 14px);
  width: 100%;
  padding-top: 8px;
}

.yt-die {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

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

.yt-die__face {
  --dot: #1a2744;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid rgba(180, 220, 255, 0.55);
  border-radius: 22%;
  background: linear-gradient(145deg, #f4fbff 0%, #d7ecfb 55%, #c4dff4 100%);
  box-shadow:
    0 8px 18px rgba(10, 24, 48, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.yt-die.is-blank .yt-die__face {
  border-color: rgba(140, 180, 220, 0.3);
  background: linear-gradient(145deg, rgba(200, 220, 240, 0.28), rgba(140, 170, 200, 0.2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.yt-die:not(:disabled):hover .yt-die__face {
  border-color: rgba(160, 235, 255, 0.9);
}

.yt-die:focus-visible {
  outline: none;
}

.yt-die:focus-visible .yt-die__face {
  outline: 3px solid #3fc4ff;
  outline-offset: 3px;
}

.yt-die__keep {
  padding: 1px 6px;
  border-radius: 999px;
  color: transparent;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.yt-die.is-held .yt-die__face {
  border-color: #3fc4ff;
  box-shadow:
    0 0 0 2px rgba(63, 196, 255, 0.45),
    0 0 14px rgba(63, 196, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transform: translateY(-6px);
}

.yt-die.is-held .yt-die__keep {
  background: #3fc4ff;
  color: #0d1730;
}

.yt-die.is-rolling .yt-die__face {
  animation: yt-die-roll 0.4s ease-in-out;
}

@keyframes yt-die-roll {
  0% { transform: rotate(0deg) scale(1); }
  30% { transform: rotate(-14deg) scale(0.92) translateY(-4px); }
  65% { transform: rotate(10deg) scale(1.04); }
  100% { transform: rotate(0deg) scale(1); }
}

/* ドット表現（CSSのみ） */
.yt-die__face::before {
  content: "";
  position: absolute;
  inset: 17%;
  background-image: radial-gradient(circle, var(--dot) 45%, transparent 48%);
  background-repeat: no-repeat;
  background-size: 30% 30%;
  opacity: 0;
}

.yt-die[data-value="1"] .yt-die__face::before {
  opacity: 1;
  background-position: center center;
}

.yt-die[data-value="2"] .yt-die__face::before {
  opacity: 1;
  background-position: left top, right bottom;
  background-image:
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%);
}

.yt-die[data-value="3"] .yt-die__face::before {
  opacity: 1;
  background-position: left top, center center, right bottom;
  background-image:
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%);
}

.yt-die[data-value="4"] .yt-die__face::before {
  opacity: 1;
  background-position: left top, right top, left bottom, right bottom;
  background-image:
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%);
}

.yt-die[data-value="5"] .yt-die__face::before {
  opacity: 1;
  background-position: left top, right top, center center, left bottom, right bottom;
  background-image:
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%);
}

.yt-die[data-value="6"] .yt-die__face::before {
  opacity: 1;
  background-position: left top, right top, left center, right center, left bottom, right bottom;
  background-image:
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%),
    radial-gradient(circle, var(--dot) 45%, transparent 48%);
}

.yt-guide {
  margin: 0;
  color: rgba(214, 234, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.yt-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.yt-actions .btn {
  min-width: min(100%, 11rem);
}

/* 役表 */
.yt-sheet {
  max-width: min(100%, 560px);
  margin: 0 auto 12px;
  padding: clamp(10px, 2.5vw, 14px);
  border: 1px solid rgba(96, 154, 214, 0.28);
  border-radius: var(--md-sys-shape-corner-large);
  background: linear-gradient(180deg, #142448 0%, #0f1a34 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.yt-sheet__groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.yt-sheet__heading {
  margin: 0 0 6px 4px;
  color: rgba(160, 235, 255, 0.8);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.yt-sheet__rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.yt-cat {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 6px 12px;
  border: 1px solid rgba(120, 170, 220, 0.22);
  border-radius: 10px;
  background: rgba(8, 16, 32, 0.4);
  color: #e8f7ff;
  font: inherit;
  text-align: left;
  cursor: default;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.yt-cat__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.yt-cat__name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.yt-cat__note {
  color: rgba(190, 220, 255, 0.6);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
}

.yt-cat__score {
  flex: 0 0 auto;
  min-width: 2.4em;
  color: rgba(190, 220, 255, 0.45);
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.yt-cat.is-available {
  border-color: rgba(63, 196, 255, 0.45);
  background: rgba(40, 90, 150, 0.28);
  cursor: pointer;
}

.yt-cat.is-available .yt-cat__score {
  color: #7fe0ff;
}

.yt-cat.is-available.is-zero {
  border-color: rgba(120, 170, 220, 0.3);
  background: rgba(8, 16, 32, 0.4);
}

.yt-cat.is-available.is-zero .yt-cat__score {
  color: rgba(190, 220, 255, 0.55);
}

.yt-cat.is-available:hover {
  border-color: rgba(160, 235, 255, 0.9);
  background: rgba(50, 110, 180, 0.38);
  box-shadow: 0 0 12px rgba(63, 196, 255, 0.22);
}

.yt-cat.is-used {
  border-color: rgba(150, 106, 255, 0.28);
  background: rgba(60, 40, 110, 0.22);
}

.yt-cat.is-used .yt-cat__name,
.yt-cat.is-used .yt-cat__note {
  color: rgba(214, 200, 255, 0.55);
}

.yt-cat.is-used .yt-cat__score {
  color: #e2d6ff;
}

.yt-cat.is-used .yt-cat__score::before {
  content: "確定";
  margin-right: 6px;
  color: rgba(200, 180, 255, 0.7);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
}

.yt-cat:focus-visible {
  outline: 2px solid #3fc4ff;
  outline-offset: 2px;
}

.yt-sheet__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
  border-top: 1px solid rgba(63, 196, 255, 0.35);
  color: #e8f7ff;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
}

.yt-sheet__total-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.yt-sheet__total-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(63, 196, 255, 0.3);
}

.yt-hint {
  margin: 0 auto;
  max-width: min(100%, 560px);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.85rem;
  line-height: 1.55;
  text-align: center;
}

@media (min-width: 600px) {
  .yt-sheet__groups {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .yt-play {
    padding-inline: 8px;
  }

  .yt-dice {
    gap: 5px;
  }

  .yt-die__keep {
    padding: 1px 4px;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }

  .yt-die.is-held .yt-die__face {
    transform: translateY(-4px);
  }

  .yt-actions .btn {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* 外枠・戻る・ステータスは共通プレイ画面を利用。役表は狭幅でも2列で比較できる。 */
html.gs-playing .yt-panel {
  align-items: center;
}
html.gs-playing .yt-panel > .gs-bar,
.yt-stage {
  width: 100%;
  max-width: 640px;
}
html.gs-playing .yt-panel > .gs-bar { gap: 12px; }
html.gs-playing .yt-panel > .gs-bar > .gs-hud {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
}
.yt-stage { position: relative; flex: none; }
html.gs-playing .yt-play,
html.gs-playing .yt-sheet { max-width: none; width: 100%; }
html.gs-playing .yt-play { padding: 12px; gap: 8px; margin-bottom: 12px; }
html.gs-playing .yt-sheet__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.gs-playing .yt-sheet__group { display: grid; grid-template-rows: auto 1fr; }
html.gs-playing .yt-sheet__rows { display: grid; grid-template-rows: repeat(6, minmax(48px, 1fr)); }
html.gs-playing .yt-guide { min-height: 3.2em; margin: 0; }
html.gs-playing .yt-actions { flex-wrap: nowrap; width: 100%; }
html.gs-playing .yt-actions #roll-btn { flex: 1; min-width: 0; }
html.gs-playing .yt-actions #restart-btn { flex: none; min-width: 44px; width: 44px; }
html.gs-playing .yt-hint { margin-top: 12px; color: var(--play-text-muted); }
html.gs-playing .yt-result {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: none;
  margin: 0;
  background: rgba(11, 20, 42, .94);
  backdrop-filter: blur(5px);
}
@media (min-width: 768px) and (min-height: 600px) {
  html.gs-playing .yt-panel {
    padding-top: max(clamp(24px, 5vh, 56px), env(safe-area-inset-top));
  }
  html.gs-playing .yt-panel > .gs-bar { margin-bottom: 28px; }
  html.gs-playing .yt-play { margin-bottom: 24px; }
}
@media (max-width: 420px) {
  html.gs-playing .yt-sheet { padding: 8px; }
  html.gs-playing .yt-sheet__groups { gap: 8px; }
  html.gs-playing .yt-cat { padding: 7px 6px; min-height: 48px; }
  html.gs-playing .yt-cat__name { font-size: .75rem; }
  html.gs-playing .yt-cat__note { font-size: .625rem; }
  html.gs-playing .yt-cat.is-used .yt-cat__score::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .yt-result, .yt-die.is-rolling .yt-die__face { animation: none; }
}
