.dice-screen {
  --di-ink: #eee5d7; --di-muted: #bcadb5; --di-gold: #ccb28c; --di-line: #513c47;
  color: var(--di-ink); font: 14px/1.5 var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  padding: 24px 0 16px; min-width: 0; container-type: inline-size;
  background: radial-gradient(ellipse at 80% 15%, #7244511f, transparent 48%);
}
.dice-screen *, .dice-screen *::before, .dice-screen *::after { box-sizing: border-box; }
.dice-screen [hidden] { display: none !important; }
.dice-screen h1, .dice-screen h2, .dice-screen p { margin: 0; }
.dice-screen h1, .dice-screen h2 { font-family: var(--serif, Georgia, serif); font-weight: 400; }
.dice-screen button, .dice-screen select { font: inherit; color: inherit; }
.dice-screen button { cursor: pointer; }
.dice-screen button:disabled { cursor: default; opacity: .48; }
.dice-screen button:focus-visible, .dice-screen select:focus-visible { outline: 2px solid var(--di-gold); outline-offset: 4px; }
.dice-screen .di-back { background: none; border: 0; color: var(--di-muted); padding: 0 8px 0 0; min-height: 44px; font-size: 12px; margin-bottom: 16px; }
.dice-screen .di-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.dice-screen .di-eyebrow { color: var(--di-gold); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
.dice-screen h1 { font-size: clamp(39px, 5.5vw, 54px); line-height: 1.13; letter-spacing: -.025em; margin: 9px 0 10px; }
.dice-screen .di-character { color: var(--di-muted); overflow-wrap: anywhere; }
.dice-screen .di-seal { width: 64px; flex: 0 0 auto; color: #a08268; transform: rotate(8deg); opacity: .7; }
.dice-screen .di-seal svg { display: block; width: 100%; }
.dice-screen .di-connection { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-block: 1px solid var(--di-line); padding: 11px 0; margin-bottom: 24px; color: var(--di-gold); }
.dice-screen .di-connection p { font-size: 12px; }
.dice-screen .di-connection.is-offline { color: var(--di-muted); }
.dice-screen .di-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 11px 16px; border: 1px solid #85606c; border-radius: 4px; background: #34242e; font-size: 13px; line-height: 1.4; }
.dice-screen .di-button:hover:not(:disabled) { background: #49303c; border-color: var(--di-gold); }
.dice-screen .di-small { padding: 10px 12px; font-size: 11px; flex-shrink: 0; }
.dice-screen .di-primary { background: #943b47; border-color: #bd7078; width: 100%; font-weight: 600; min-height: 52px; letter-spacing: .02em; }
.dice-screen .di-primary:hover:not(:disabled) { background: #a94855; }
.dice-screen .di-error, .dice-screen .di-pending { border: 1px solid #9b6870; background: #3f252c; border-radius: 4px; padding: 14px 16px; margin-bottom: 20px; overflow-wrap: anywhere; }
.dice-screen .di-pending { border-color: #8f7956; color: #e4cda7; background: #352c24; }
.dice-screen .di-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: stretch; }
.dice-screen .di-panel { min-width: 0; border: 1px solid var(--di-line); border-radius: 5px; background: linear-gradient(135deg, #49303822, transparent 65%), #211b21; padding: clamp(20px, 3vw, 32px); }
.dice-screen h2 { font-size: 29px; line-height: 1.2; }
.dice-screen .di-compose > h2 { margin: 10px 0 12px; }
.dice-screen .di-description { color: var(--di-muted); font-size: 13px; line-height: 1.7; }
.dice-screen .di-compose > .di-description { margin-bottom: 24px; max-width: 34em; }
.dice-screen .di-field { margin: 16px 0; min-width: 0; }
.dice-screen .di-field label { display: block; font-size: 12px; margin-bottom: 8px; color: #d5c5c9; }
.dice-screen select { appearance: none; contain: paint; width: 100%; min-width: 0; min-height: 48px; padding: 10px 32px 10px 12px; color-scheme: dark; border: 1px solid #65505c; background: #2b222b; background-image: linear-gradient(45deg, transparent 50%, #ccb28c 50%), linear-gradient(135deg, #ccb28c 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; border-radius: 4px; font-size: 14px; }
.dice-screen select:disabled { opacity: .65; }
.dice-screen .di-profile-note { color: var(--di-muted); font-size: 11px; line-height: 1.65; }
.dice-screen .di-profile-note.is-custom { border-left: 2px solid #b09a75; padding-left: 12px; color: #dfc99f; }
.dice-screen .di-pool { margin: 24px 0 20px; padding: 20px 0; text-align: center; border-block: 1px solid var(--di-line); }
.dice-screen .di-pool-math { color: var(--di-muted); font-size: 12px; }
.dice-screen .di-pool-total { color: var(--di-gold); font-family: var(--serif, Georgia, serif); font-size: 23px; padding: 4px 0 6px; }
.dice-screen .di-pool-total strong { font-weight: 400; font-size: 54px; line-height: 1.15; }
.dice-screen .di-pool-detail { color: var(--di-muted); font-size: 10px; }
.dice-screen .di-validation { color: #edb1b7; padding-bottom: 18px; font-size: 12px; }
.dice-screen .di-footnote { font-size: 10px; color: var(--di-muted); line-height: 1.7; }
.dice-screen .di-compose > .di-footnote { text-align: center; margin-top: 13px; }
.dice-screen .di-result { display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 30%, #55313f44, transparent 68%), #241c24; }
.dice-screen .di-result.is-empty { align-items: center; justify-content: center; text-align: center; min-height: 510px; }
.dice-screen .di-empty-art { width: 112px; color: #aa896a; margin: 47px 0 30px; filter: drop-shadow(0 0 20px #c49a6620); }
.dice-screen .di-empty-art svg { display: block; width: 100%; }
.dice-screen .is-empty h2 { margin-bottom: 14px; }
.dice-screen .is-empty .di-description { max-width: 26em; }
.dice-screen .is-empty .di-footnote { margin-top: 52px; }
.dice-screen .di-result-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 48px; }
.dice-screen .di-verified { border: 1px solid #66523f; border-radius: 20px; padding: 4px 9px; color: #d2bf9d; font-size: 10px; }
.dice-screen .di-outcome { font-size: clamp(36px, 4vw, 49px); text-align: center; color: #e5d0ac; }
.dice-screen .di-outcome.is-botch { color: #eda5ac; }
.dice-screen .di-result-sub { margin-top: 12px; text-align: center; color: var(--di-muted); font-size: 12px; }
.dice-screen .di-faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 32px 0 22px; }
.dice-screen .di-die { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 48px; width: 48px; height: 56px; background: #493642; color: #c3b0bd; clip-path: polygon(50% 0, 94% 25%, 85% 77%, 50% 100%, 15% 77%, 6% 25%); font: 24px var(--serif, Georgia, serif); font-variant-numeric: tabular-nums; }
.dice-screen .di-die.is-success { background: #b99b72; color: #211921; text-shadow: 0 1px #ebd4ab33; }
.dice-screen .di-die.is-ten { background: #e3c596; }
.dice-screen .di-die.is-one { background: #7d3545; color: #ffdde0; }
.dice-screen .di-counting { text-align: center; color: var(--di-muted); font-size: 11px; margin-bottom: 30px; }
.dice-screen .di-result-facts { margin: auto 0 20px; border-top: 1px solid var(--di-line); padding-top: 20px; }
.dice-screen .di-result-facts > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; margin: 12px 0; font-size: 12px; }
.dice-screen dt { color: var(--di-muted); }
.dice-screen dd { margin: 0; overflow-wrap: anywhere; }
.dice-screen .di-history { margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--di-line); }
.dice-screen .di-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.dice-screen .di-history-count { font-size: 11px; color: var(--di-muted); }
.dice-screen .di-history-list { margin-top: 18px; }
.dice-screen .di-history-empty { padding: 24px 0; font-size: 12px; color: var(--di-muted); }
.dice-screen .di-history-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 16px; width: 100%; min-height: 78px; padding: 16px 6px; border: 0; border-bottom: 1px solid var(--di-line); text-align: left; background: transparent; }
.dice-screen .di-history-row:hover { background: #3a293333; }
.dice-screen .di-roll-number { color: #a38a75; font-size: 11px; font-variant-numeric: tabular-nums; }
.dice-screen .di-history-names, .dice-screen .di-history-outcome { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.dice-screen .di-history-names strong { font-weight: 400; font-size: 13px; overflow-wrap: anywhere; }
.dice-screen .di-history-names > span, .dice-screen .di-history-outcome > span { font-size: 10px; color: var(--di-muted); }
.dice-screen .di-history-outcome { text-align: right; }
.dice-screen .di-history-outcome strong { font-weight: 400; color: var(--di-gold); font-size: 13px; }
.dice-screen .di-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@container (max-width: 660px) {
  .dice-screen .di-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .dice-screen .di-result.is-empty { min-height: 390px; }
  .dice-screen .di-empty-art { margin: 28px 0 24px; width: 90px; }
  .dice-screen .is-empty .di-footnote { margin-top: 28px; }
  .dice-screen .di-result-top { margin-bottom: 32px; }
  .dice-screen .di-result-facts { margin-top: 12px; }
}
@container (max-width: 360px) {
  .dice-screen .di-seal { display: none; }
  .dice-screen .di-panel { padding: 19px 16px; }
  .dice-screen .di-connection { align-items: flex-start; flex-direction: column; gap: 7px; }
  .dice-screen .di-small { width: 100%; }
  .dice-screen .di-history-row { grid-template-columns: 25px minmax(0, 1fr); gap: 10px; }
  .dice-screen .di-history-outcome { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
  .dice-screen .di-die { flex-basis: 42px; width: 42px; height: 49px; font-size: 22px; }
  .dice-screen .di-faces { gap: 7px; }
  .dice-screen .di-result-facts > div { grid-template-columns: 60px minmax(0, 1fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .dice-screen *, .dice-screen *::before, .dice-screen *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Hunger replaces ordinary dice and stays visibly distinct at every face. */
.di-die.is-hunger { background: #6b1630; color: #fff0d1; border-color: #ea8b9a; box-shadow: inset 0 0 0 2px #3c0b1e; }
