﻿/* platform-shell shell-base.css — brand, cards, buttons, toast, confirm, conn-status */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61, 156, 240, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(240, 193, 75, 0.08), transparent),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled,
button.is-locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.45);
  box-shadow: none;
  transform: none;
}

button:disabled:active,
button.is-locked:active {
  transform: none;
}

.app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  min-height: 100dvh;
}

body.play-active .app {
  /* Extra room for fixed bottom dock */
  padding-bottom: 0;
}

.hidden {
  display: none !important;
}

/* â€”â€” Themed confirm dialog â€”â€” */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.confirm-dialog.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.confirm-dialog-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: 20px;
  text-align: center;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(61, 156, 240, 0.22), transparent 58%),
    linear-gradient(165deg, #1e2d42 0%, #152030 55%, #0f1722 100%);
  border: 1px solid rgba(100, 160, 220, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(61, 156, 240, 0.12);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.22, 1.15, 0.36, 1);
}

.confirm-dialog.is-open .confirm-dialog-card {
  transform: scale(1) translateY(0);
}

.confirm-dialog.is-danger .confirm-dialog-card {
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(232, 93, 93, 0.22), transparent 58%),
    linear-gradient(165deg, #3a1f24 0%, #241418 55%, #140c0e 100%);
  border-color: rgba(232, 93, 93, 0.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(232, 93, 93, 0.14);
}

.confirm-dialog.is-warning .confirm-dialog-card {
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(240, 160, 48, 0.2), transparent 58%),
    linear-gradient(165deg, #3a2a14 0%, #241a0c 55%, #141008 100%);
  border-color: rgba(240, 160, 48, 0.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(240, 160, 48, 0.12);
}

.confirm-dialog-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #9cc9f5;
  margin-bottom: 0.45rem;
}

.confirm-dialog.is-danger .confirm-dialog-kicker {
  color: #f5a8a8;
}

.confirm-dialog.is-warning .confirm-dialog-kicker {
  color: #f0c14b;
}

.confirm-dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.confirm-dialog-message {
  margin: 0 0 1.15rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
}

.confirm-dialog-actions {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.confirm-dialog-actions > button {
  flex: 1 1 0;
  width: auto;
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border-radius: 11px;
}

.confirm-dialog-cancel {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.confirm-dialog-cancel:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.confirm-dialog.is-danger .confirm-dialog-ok {
  background: linear-gradient(160deg, #e85d5d, #b83a3a) !important;
  color: #fff !important;
  border: none !important;
}

.confirm-dialog.is-warning .confirm-dialog-ok {
  background: linear-gradient(160deg, #f0a030, #c47a18) !important;
  color: #1a1408 !important;
  border: none !important;
}

/* â€”â€” Header â€”â€” */
.brand {
  text-align: center;
  padding: 1.25rem 0 0.5rem;
}

.brand h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.12em;
  color: var(--bank-gold);
  text-shadow: 0 0 24px rgba(240, 193, 75, 0.35);
}

.brand .conn-status {
  margin-top: 0.4rem;
}

/* â€”â€” Cards â€”â€” */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 156, 240, 0.2);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: #fff;
  margin-top: 0.25rem;
}

.btn-secondary {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-bank {
  width: 100%;
  background: linear-gradient(160deg, var(--bank-gold), var(--bank-gold-dim));
  color: #1a1408;
  font-size: 1.35rem;
  padding: 1.1rem;
  letter-spacing: 0.08em;
  box-shadow: 0 4px 20px rgba(240, 193, 75, 0.3);
}

.btn-roll {
  width: 100%;
  background: linear-gradient(160deg, var(--success), #2a9d66);
  color: #062418;
  font-size: 1.2rem;
  padding: 1rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1.25rem 0 0.25rem;
}

.home-host-actions {
  margin-top: 0.5rem;
}

.home-host-actions .divider {
  margin: 1rem 0 0.15rem;
}

#home-create-card {
  margin-top: 1rem;
}

#home-identity-card {
  margin-bottom: 1rem;
}

#home-identity-card.is-needs-name {
  border-color: rgba(240, 160, 48, 0.55);
  box-shadow: 0 0 0 2px rgba(240, 160, 48, 0.18);
}

#home-identity-card.is-needs-name #join-name {
  border-color: rgba(240, 160, 48, 0.65);
}

.home-identity-hint {
  margin: -0.25rem 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#home-public-card {
  margin-bottom: 1rem;
}

#home-join-card {
  margin-bottom: 0.25rem;
}

.public-games-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.public-games-header h2 {
  margin: 0;
}

.btn-ghost-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-sm:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

.public-games-hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.public-games-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.public-game-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.public-game-main {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.public-game-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
}

.public-game-code {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
}

.public-game-host {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.public-game-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
  margin-top: 0.15rem;
}

.public-game-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact join control â€” overrides .btn-primary width:100% */
.public-game-row .btn-public-join.btn-primary {
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  max-width: none;
  min-width: 0;
  margin-top: 0;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 0.25rem 0.5rem;
  border-radius: 7px;
  white-space: nowrap;
}

.public-game-row .btn-public-join.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.public-games-empty {
  margin: 0.25rem 0 0;
  text-align: center;
}

.visibility-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

/* Override .field input { width: 100% } so radios sit left of the text */
.radio-label input[type='radio'],
.field .radio-label input[type='radio'] {
  width: auto;
  min-width: 1rem;
  height: auto;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  align-self: center;
  accent-color: var(--accent);
}

.radio-label span {
  flex: 1 1 auto;
  min-width: 0;
}

.radio-label strong {
  color: var(--bank-gold);
}

/* â€”â€” Toast / errors â€”â€” */
.toast {
  position: fixed;
  left: 50%;
  top: 1rem;
  bottom: auto;
  transform: translateX(-50%) translateY(-120%);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.75rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: min(90vw, 400px);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.toast.error {
  border-color: rgba(232, 93, 93, 0.5);
  background: #3a1f24;
}

.conn-status {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.conn-status.live {
  color: var(--success);
}

.conn-status.down {
  color: var(--danger);
}
