/* ---- Spiel page layout ---- */
html.spiel-auth-pending body {
  visibility: hidden;
}

#spiel-app {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(8px, 2vw, 24px);
  box-sizing: border-box;
  font-family: 'Jersey 15', sans-serif;
  font-size: 1.125rem;
}

#spiel-layout {
  --control-pane-ratio: 1;
  --game-pane-ratio: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: clamp(12px, 2vw, 24px);
  width: min(100%, 1440px);
}

/* ---- Shared floating pane ---- */
.dash-container {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  color: #222033;
  background: rgba(248, 247, 252, 0.94);
  border: 1px solid rgba(105, 71, 152, 0.28);
  border-radius: 10px;
  box-shadow:
    0 1px 2px rgba(34, 25, 55, 0.08),
    0 18px 48px rgba(54, 42, 105, 0.22);
  backdrop-filter: blur(12px);
}

/* ---- Control pane ---- */
#spiel-control-pane {
  flex: var(--control-pane-ratio) 1 220px;
  min-width: 0;
  min-height: 60rem;
  padding: clamp(16px, 2.5vw, 28px);
  box-sizing: border-box;
  background: rgba(105, 71, 152, 0.3); /* Temporary layout color. */
}

.spiel-control-section {
  min-width: 0;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(105, 71, 152, 0.3);
}

.spiel-control-section-title {
  margin: 0;
  color: #222033;
  font-size: 1.1rem;
  line-height: 1.2;
  text-align: left;
}

.spiel-session-settings {
  margin: 0.75rem 0 0;
}

.spiel-session-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(105, 71, 152, 0.22);
}

.spiel-session-setting-row dt {
  font-weight: 400;
}

.spiel-session-setting-row dd {
  min-width: 0;
  margin: 0;
  font-size: 1.15rem;
  color: #3d315a;
  overflow-wrap: anywhere;
  text-align: right;
}

.spiel-session-description {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(105, 71, 152, 0.22);
}

.spiel-session-description-title {
  margin: 0 0 0.35rem;
  color: #222033;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.1;
  text-align: left;
}

.spiel-session-description-content {
  margin: 0;
  color: #3d315a;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.spiel-session-control-row {
  margin-top: 0.75rem;
}

.spiel-session-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.spiel-current-session-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.spiel-current-session-actions .spiel-session-action {
  flex: 1 1 50%;
  min-width: 0;
}

.spiel-session-action {
  min-height: 2.75rem;
  border: 1px solid rgba(81, 90, 218, 0.45);
  background: rgba(105, 71, 152, 0.62); /* Temporary layout color. */
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.spiel-session-action:hover {
  background: rgba(81, 90, 218, 0.7);
}

.spiel-other-sessions {
  position: relative;
}

.spiel-other-sessions summary {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  list-style: none;
  user-select: none;
}

.spiel-other-sessions summary::-webkit-details-marker {
  display: none;
}

.spiel-other-session-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0.4rem;
  background: rgba(248, 247, 252, 0.96);
  border: 1px solid rgba(81, 90, 218, 0.35);
  list-style: none;
}

.spiel-other-session-list button {
  width: 100%;
  min-height: 2.25rem;
  border: 0;
  background: rgba(201, 220, 255, 0.48); /* Temporary layout color. */
  color: #222033;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.spiel-other-session-list button:hover {
  background: rgba(105, 71, 152, 0.32);
}

.spiel-session-participants-title {
  display: block;
  margin: 0 0 0.4rem;
  color: #222033;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.1;
  text-align: left;
}

.spiel-session-participants {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(105, 71, 152, 0.22);
}

.spiel-session-participant-list {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.spiel-session-participant-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
  background: rgba(105, 71, 152, 0.18); /* Temporary layout color. */
  border-left: 0.25rem solid rgba(105, 71, 152, 0.55);
}

.spiel-session-participant-status {
  flex: 0 0 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  background: rgba(105, 71, 152, 0.24);
  border: 1px solid rgba(105, 71, 152, 0.45);
  border-radius: 50%;
}

.spiel-session-participant-status.is-present {
  background: #6fc39a;
  border-color: #438f6b;
}

.spiel-session-editor {
  width: min(90vw, 28rem);
  padding: 1.25rem;
  box-sizing: border-box;
  color: #222033;
  background: rgba(248, 247, 252, 0.98);
  border: 1px solid rgba(105, 71, 152, 0.4);
  box-shadow: 0 18px 48px rgba(54, 42, 105, 0.3);
  font-family: 'Jersey 15', sans-serif;
}

.spiel-session-editor::backdrop {
  background: rgba(34, 25, 55, 0.35);
}

.spiel-session-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.spiel-session-editor-title {
  margin: 0;
  color: #222033;
  font-size: 1.75rem;
  line-height: 1;
  text-align: left;
}

.spiel-close-session-editor {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(81, 90, 218, 0.4);
  background: rgba(201, 220, 255, 0.55);
  color: #222033;
  cursor: pointer;
  font: inherit;
  font-size: 1.5rem;
}

.spiel-session-control-label {
  display: block;
  margin-bottom: 0.3rem;
}

.spiel-session-option-group {
  display: flex;
  width: 100%;
}

.spiel-session-option {
  flex: 1 1 50%;
  min-width: 0;
  min-height: 2.25rem;
  border: 1px solid rgba(81, 90, 218, 0.4);
  background: rgba(201, 220, 255, 0.48); /* Temporary layout color. */
  color: #222033;
  cursor: pointer;
  font: inherit;
}

.spiel-session-option + .spiel-session-option {
  border-left: 0;
}

.spiel-session-option[aria-pressed="true"] {
  background: rgba(105, 71, 152, 0.62); /* Temporary selected color. */
  color: #fff;
}

.spiel-session-option:hover {
  background: rgba(81, 90, 218, 0.58);
  color: #fff;
}

/* ---- Game content pane ---- */
#spiel-game-pane {
  --spiel-game-row-height: 5rem;
  --spiel-game-lower-square-size: 3.75rem; /* 75% of the 5rem upper square. */
  --spiel-game-lower-focus-size: 5.625rem; /* 150% of the lower square. */
  display: flex;
  flex: var(--game-pane-ratio) 1 620px;
  flex-direction: column;
  min-width: 0;
  min-height: 60rem;
}

.spiel-tiers-header {
  flex: 0 0 auto;
  overflow: hidden;
  padding: 1rem 0.5rem;
  box-sizing: border-box;
  background: rgba(201, 220, 255, 0.5); /* Temporary layout color. */
  border-bottom: 1px solid rgba(81, 90, 218, 0.25);
}

.spiel-tiers-title {
  display: block;
  width: 100%;
  margin: 0;
  color: #222033;
  font-family: 'Jersey 15', sans-serif;
  font-size: clamp(3rem, 4vw, 4.5rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 0.9;
  text-align: center;
  transform: scaleX(1.12);
  transform-origin: center;
}

.spiel-tier-list-header {
  flex: 0 0 auto;
  padding: 0.75rem;
  box-sizing: border-box;
  background: rgba(201, 220, 255, 0.42); /* Temporary layout color. */
  border-bottom: 1px solid rgba(81, 90, 218, 0.25);
}

.spiel-tier-list-title {
  margin: 0;
  color: #222033;
  font-family: 'Jersey 15', sans-serif;
  font-size: 1.75rem;
  line-height: 1.2;
  text-align: left;
}

#spiel-game-upper,
#spiel-game-lower {
  flex: 1 1 50%;
  min-height: 0;
  padding: clamp(18px, 3vw, 36px);
  box-sizing: border-box;
}

#spiel-game-upper {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 0.75rem;
  background: rgba(201, 220, 255, 0.7); /* Temporary layout color. */
  border-bottom: 1px solid rgba(81, 90, 218, 0.25);
}

.spiel-game-row {
  display: flex;
  align-items: stretch;
  flex: 0 0 var(--spiel-game-row-height);
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: rgba(81, 90, 218, 0.24); /* Temporary layout color. */
  box-shadow: inset 0 0 0 1px rgba(81, 90, 218, 0.38);
}

.spiel-game-row-left {
  display: grid;
  place-items: center;
  flex: 0 0 var(--spiel-game-row-height);
  width: var(--spiel-game-row-height);
  height: var(--spiel-game-row-height);
  box-sizing: border-box;
  background: rgba(105, 71, 152, 0.48); /* Temporary layout color. */
  border-right: 1px solid rgba(81, 90, 218, 0.38);
}

.spiel-game-row-label {
  font-family: 'Jersey 15', sans-serif;
  font-size: 4.75rem;
  font-weight: 400;
  line-height: 1;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(34, 25, 55, 0.3);
}

.spiel-game-row-right {
  flex: 1 1 0;
  min-width: 0;
  height: var(--spiel-game-row-height);
  box-sizing: border-box;
  background: rgba(201, 220, 255, 0.4); /* Temporary layout color. */
}

#spiel-game-lower {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.125rem;
  background: rgba(239, 213, 255, 0.72); /* Temporary layout color. */
}

.spiel-game-lower-focus {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.spiel-game-lower-left,
.spiel-game-lower-info {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
}

.spiel-game-lower-left {
  display: flex;
  flex-direction: column;
  background: rgba(201, 220, 255, 0.28); /* Temporary layout color. */
}

.spiel-game-lower-info {
  display: flex;
  flex-direction: column;
  background: rgba(105, 71, 152, 0.18); /* Temporary layout color. */
  border-left: 1px solid rgba(105, 71, 152, 0.3);
}

.spiel-game-lower-item-title {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  box-sizing: border-box;
}

.spiel-game-lower-controls {
  --spiel-item-control-size: 3rem;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  min-height: 0;
  padding: 1rem;
  box-sizing: border-box;
  background: rgba(201, 220, 255, 0.2); /* Temporary layout color. */
  border-top: 1px solid rgba(81, 90, 218, 0.24);
}

.spiel-item-control-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: var(--spiel-item-control-size);
}

.spiel-score-row {
  justify-content: space-between;
}

.spiel-score-label {
  color: #222033;
  font-size: 1.25rem;
  font-weight: 700;
}

.spiel-score-value,
.spiel-skip-vote {
  display: grid;
  place-items: center;
  flex: 0 0 var(--spiel-item-control-size);
  width: var(--spiel-item-control-size);
  height: var(--spiel-item-control-size);
  box-sizing: border-box;
}

.spiel-score-value {
  background: rgba(201, 220, 255, 0.72); /* Temporary layout color. */
  border: 1px solid rgba(81, 90, 218, 0.42);
  font-size: 2rem;
  font-weight: 800;
}

.spiel-cast-vote-row,
.spiel-party-controls-row {
  gap: 0.75rem;
}

.spiel-cast-vote,
.spiel-next-item,
.spiel-skip-vote {
  border: 1px solid rgba(81, 90, 218, 0.45);
  background: rgba(105, 71, 152, 0.62); /* Temporary layout color. */
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.spiel-cast-vote,
.spiel-next-item {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--spiel-item-control-size);
  font-size: 1.1rem;
}

.spiel-pending-voters {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
  min-height: var(--spiel-item-control-size);
}

.spiel-participant-vote-status {
  display: grid;
  place-items: center;
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  box-sizing: border-box;
  background: rgba(105, 71, 152, 0.58); /* Still voting. */
  border: 1px solid rgba(81, 90, 218, 0.48);
  border-radius: 50%;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
}

.spiel-participant-vote-status.has-voted {
  background: #6fc39a;
  border-color: #438f6b;
}

.spiel-participant-vote-status.is-offline {
  background: rgba(105, 71, 152, 0.24);
  border-color: rgba(105, 71, 152, 0.45);
  color: rgba(34, 32, 51, 0.62);
}

.spiel-cast-vote:hover,
.spiel-next-item:hover,
.spiel-skip-vote:hover {
  background: rgba(81, 90, 218, 0.7);
}

.spiel-game-lower-focus-square {
  flex: 0 0 var(--spiel-game-lower-focus-size);
  width: var(--spiel-game-lower-focus-size);
  height: var(--spiel-game-lower-focus-size);
  box-sizing: border-box;
  background: rgba(81, 90, 218, 0.52); /* Temporary layout color. */
  border: 1px solid rgba(81, 90, 218, 0.7);
}

.spiel-game-lower-item-name {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  min-width: 0;
  min-height: var(--spiel-game-lower-focus-size);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.spiel-game-lower-info-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.24); /* Temporary layout color. */
  border-top: 1px solid rgba(81, 90, 218, 0.24);
}

.spiel-item-document {
  min-height: 100%;
  padding: 1.25rem;
  overflow-y: auto;
  box-sizing: border-box;
  color: #222033;
  background: rgba(248, 247, 252, 0.72);
  border: 1px solid rgba(81, 90, 218, 0.28);
  font-family: 'Roboto', Arial, Helvetica, sans-serif;
}

.spiel-item-document-title {
  margin: 0 0 1rem;
  color: #3d315a;
  font-family: 'Jersey 15', sans-serif;
  font-size: 1.75rem;
  line-height: 1.2;
  text-align: left;
}

.spiel-item-metadata {
  margin: 0;
}

.spiel-item-metadata-row {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(105, 71, 152, 0.14);
}

.spiel-item-metadata-row dt {
  font-weight: 700;
}

.spiel-item-metadata-row dd {
  min-width: 0;
  margin: 0;
}

.spiel-item-notes {
  min-height: 5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(105, 71, 152, 0.2);
  line-height: 1.5;
  white-space: pre-wrap;
}

.spiel-game-lower-row {
  display: flex;
  flex: 0 0 auto;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.125rem;
  box-sizing: border-box;
}

.spiel-game-lower-square {
  flex: 0 0 var(--spiel-game-lower-square-size);
  width: var(--spiel-game-lower-square-size);
  height: var(--spiel-game-lower-square-size);
  box-sizing: border-box;
  background: rgba(105, 71, 152, 0.4); /* Temporary layout color. */
  border: 1px solid rgba(105, 71, 152, 0.58);
}

/* ---- Small screens ---- */
@media (max-width: 600px) {
  #spiel-app {
    padding: 6px;
  }

  #spiel-layout {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .dash-container {
    border-radius: 8px;
  }

  #spiel-control-pane {
    flex-basis: auto;
    min-height: 140px;
  }

  #spiel-game-pane {
    flex-basis: auto;
    min-height: 0;
  }

  #spiel-game-upper,
  #spiel-game-lower {
    flex: 0 0 auto;
    min-height: auto;
  }

  .spiel-game-lower-focus {
    flex: 0 0 auto;
    flex-direction: column;
  }

  .spiel-game-lower-left,
  .spiel-game-lower-info {
    flex: 0 0 auto;
    width: 100%;
  }

  .spiel-game-lower-info {
    border-top: 1px solid rgba(105, 71, 152, 0.3);
    border-left: 0;
  }

  .spiel-game-lower-controls,
  .spiel-game-lower-info-content {
    flex: 0 0 auto;
    min-height: auto;
  }

  .spiel-item-document {
    min-height: 0;
  }
}
