/* Rilvaris: room rules, rematch, spectators (lobby / results) and the arena extras:
   surrender + draw dialogs, full journal, graveyard, learning coach, end-of-turn warning. */

/* ---------- lobby: rules panel ---------- */
.rx-extra { grid-template-columns: 1fr; margin-top: 24px; }
.rx-field { display: grid; gap: 7px; margin: 0 0 16px; }
.rx-field > b { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #8b6e3f; }
.rx-field > div { display: flex; flex-wrap: wrap; gap: 7px; }
.rx-chip { padding: 9px 13px; background: #eee4d1; color: #62573f; border: 1px solid #ccbd9d; border-radius: 2px; font-size: 11px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.rx-chip:hover:not(:disabled) { border-color: #a98f5c; background: #f4ecdb; }
.rx-chip.on { background: #163958; color: #ffe1a0; border-color: #163958; }
.rx-chip:disabled { opacity: .5; cursor: not-allowed; }
.rx-note { margin: 4px 0 0; padding: 9px 12px; background: #f6ecd2; border-left: 3px solid #e0a92e; font-size: 12px; line-height: 1.55; color: #5b4c2c; }
.rx-note.ok { background: #e9f1e4; border-color: #6fa65a; color: #34502b; }
.rx-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 18px; margin: 0 0 12px; }
.rx-summary div { padding: 8px 10px; background: #fffdf5; border: 1px solid #e1d3b3; }
.rx-summary dt { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #8b6e3f; }
.rx-summary dd { margin: 3px 0 0; font-weight: 800; font-size: 14px; color: #17334c; }
.rx-watchers { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #e1d3b3; font-size: 12px; color: #4b4333; }
.rx-watchers .muted { color: #8a8272; }
.rx-watch { text-align: center; }
.rx-watch .rx-summary { max-width: 640px; margin: 18px auto; text-align: left; }
.rl-watch-link { margin-top: 10px; }

/* ---------- results: rematch ---------- */
.rx-rematch { display: grid; justify-items: center; gap: 12px; max-width: 520px; margin: 22px auto 0; padding: 16px 18px; background: #fffaf1cc; border: 1px solid #cebd9c; text-align: center; }
.rx-rematch p { margin: 0; font-size: 14px; font-weight: 700; color: #17334c; }
.rx-rematch div { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.rx-watch-note { max-width: 520px; margin: 20px auto 0; padding: 12px 16px; background: #f6ecd2; border-left: 3px solid #e0a92e; font-size: 13px; color: #5b4c2c; }

/* ---------- arena: end-of-turn warning ---------- */
.duel .dl-turn-progress { height: 5px; border-radius: 3px; overflow: hidden; }
.duel .dl-turn-progress .mg-bar { height: 5px; }
@keyframes dl-warn-pulse { from { filter: brightness(1); } to { filter: brightness(1.5); } }
@keyframes dl-warn-glow { from { box-shadow: 0 0 0 0 #ff5a5a00; } to { box-shadow: 0 0 22px 4px #ff5a5acc; } }
.dl-time-warn .dl-turn-progress .mg-bar i { background: linear-gradient(90deg, #b3202a, #ff6a5a); animation: dl-warn-pulse .55s ease-in-out infinite alternate; }
.dl-time-warn .dl-turn { color: #ff9a8a; border-color: #ff5a5a88; }
.dl-time-warn .dl-end.on { animation: dl-warn-glow .55s ease-in-out infinite alternate; border-radius: 12px; }
.dl-time-banner { position: fixed; left: 50%; top: 18%; z-index: 90; translate: -50% 0; padding: 12px 26px; border-radius: 999px; background: #3b0d12ee; color: #ffd9d3; border: 2px solid #ff6a5a; font: 800 20px 'Fraunces', Georgia, serif; letter-spacing: .02em; box-shadow: 0 12px 34px #000a; pointer-events: none; animation: dl-banner 2.4s ease-out forwards; }
@keyframes dl-banner { 0% { opacity: 0; translate: -50% -14px; } 12% { opacity: 1; translate: -50% 0; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- arena: dialogs ---------- */
.dl-modal-back { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 18px; background: #04080fcc; backdrop-filter: blur(3px); animation: rq-fade .2s ease-out; }
.dl-modal { width: min(400px, 100%); padding: 24px 24px 20px; background: #101923; color: #eee3cb; border: 1px solid #c8a66566; border-radius: 12px; box-shadow: 0 30px 70px #000c; text-align: center; }
.dl-modal h3 { margin: 0 0 10px; font: 800 22px 'Fraunces', Georgia, serif; color: #f0d79f; }
.dl-modal p { margin: 0 0 18px; font-size: 14px; line-height: 1.6; color: #c9ccd6; }
.dl-modal-actions { display: grid; gap: 9px; }
.dl-modal-actions .btn { min-height: 44px; }
.dl-modal .btn-danger { background: #8e1f2b; color: #fff0ec; border: 1px solid #c5434f; font-weight: 800; cursor: pointer; border-radius: 8px; }
.dl-modal .btn-danger:hover { background: #a62b38; }

/* ---------- arena: side panel (journal, graveyard, room info) ---------- */
.dl-hist-head { margin-top: 6px; padding: 4px 0 !important; border-bottom: 1px solid #c8a66544 !important; color: #f0d79f !important; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.dl-history { overflow: auto; flex: 1 1 auto; min-height: 0; }
.dl-side-grave { flex: 1; min-height: 0; }
.dl-grave { overflow: auto; padding: 0 14px 12px; display: grid; gap: 14px; align-content: start; scrollbar-width: thin; }
.dl-grave h4 { margin: 4px 0 6px; font-size: 12px; color: #f0d79f; letter-spacing: .04em; }
.dl-grave h5 { margin: 8px 0 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #9da7b6; }
.dl-grave h5 em { font-style: normal; color: #c8a665; }
.dl-grave ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.dl-grave li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 12px; background: #ffffff0a; border-left: 3px solid var(--fc, #8a8f9c); color: #d8d2c2; }
.dl-grave li.f-fire { border-color: #ff7a4a; } .dl-grave li.f-water { border-color: #4aa8ff; } .dl-grave li.f-nature { border-color: #5fcf6a; } .dl-grave li.f-storm { border-color: #ffd23f; } .dl-grave li.f-dark { border-color: #a074e8; }
.dl-grave-cost { display: grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; background: #1a4a8a; color: #fff; font-size: 11px; font-weight: 800; }
.dl-grave-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-grave small { color: #9da7b6; font-size: 10.5px; }
.dl-grave p.muted { margin: 0; font-size: 12px; color: #7d8594; }
.dl-room-rules { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 12px 0; }
.dl-room-rules span { padding: 3px 8px; border-radius: 999px; background: #c8a66522; border: 1px solid #c8a66544; color: #f0d79f; font-size: 11px; font-weight: 700; }
.dl-room-rules small { flex-basis: 100%; color: #9da7b6; font-size: 11px; }
.dl-watchers { margin: 8px 12px 0; font-size: 12px; color: #9da7b6; }
.dl-draw { margin: 6px 10px 0; font-size: 12px; }
.dl-draw:disabled { opacity: .55; cursor: default; }

/* ---------- arena: learning coach ---------- */
@keyframes dl-hint-glow { from { box-shadow: 0 0 0 2px #ffd35a, 0 0 8px #ffd35a88; } to { box-shadow: 0 0 0 3px #fff0b8, 0 0 24px #ffd35acc; } }
.dl-row-bottom { position: relative; }
.dl-coach-slot { display: contents; }
.dl-coach { position: absolute; z-index: 4; top: 0; right: 0; width: calc(100% - 476px); min-width: 290px; box-sizing: border-box; display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; background: #1f1a0cf5; color: #f6e7be; border: 1px solid #e0a92e; border-radius: 10px; box-shadow: 0 8px 22px #0008; text-align: left; font-size: 13px; line-height: 1.45; }
.dl-coach > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dl-coach b { color: #ffd35a; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.dl-coach small { color: #bfae80; font-size: 11.5px; }
.dl-coach-icon { font-size: 20px; line-height: 1.2; }
.dl-coach-close, .dl-coach-show { background: none; border: 0; color: #bfae80; cursor: pointer; font-size: 12px; }
.dl-coach-close { padding: 2px 6px; font-size: 14px; }
.dl-coach-show { position: absolute; z-index: 4; top: 2px; right: 6px; padding: 4px 8px; background: #1f1a0cd9; border-radius: 8px; color: #e0c68e; text-decoration: underline; }
.dl-card.hinted { animation: dl-hint-glow .8s ease-in-out infinite alternate; }
.dl-unit.hinted .dl-unit-body, .dl-power.hinted .dl-power-face { animation: dl-hint-glow .8s ease-in-out infinite alternate; border-radius: 50%; }
.dl-unit.hint-target .dl-unit-body, .dl-portrait.hint-target .dl-portrait-face { box-shadow: 0 0 0 3px #ff9a3a, 0 0 22px #ff9a3acc; }
.dl-end.hinted { animation: dl-hint-glow .8s ease-in-out infinite alternate; border-radius: 12px; }
@media (max-width: 760px) { .dl-coach { font-size: 12px; } .dl-modal { padding: 20px 16px 16px; } }
@media (prefers-reduced-motion: reduce) { .dl-time-warn .dl-turn-progress .mg-bar i, .dl-time-warn .dl-end.on, .dl-card.hinted, .dl-unit.hinted .dl-unit-body, .dl-power.hinted .dl-power-face, .dl-end.hinted, .dl-time-banner, .dl-modal-back { animation: none; } .dl-time-banner { opacity: 1; } }

/* Small screens: the table grows with its content, so the coach sits in the flow above the hero panel. */
@media (max-width: 960px) {
  .dl-coach { position: static; width: auto; min-width: 0; margin: 0 0 6px; }
  .dl-coach-show { position: static; display: block; margin: 0 0 4px; padding: 2px 4px; background: none; text-align: left; }
}
@media (min-width: 961px) and (max-width: 1200px) {
  .dl-coach { font-size: 12px; padding: 6px 10px; min-width: 300px; }
  .dl-coach small { display: none; }
}
