:root {
  --bg: #f5f7f3;
  --ink: #202426;
  --muted: #667174;
  --panel: #ffffff;
  --line: #d9e0dc;
  --accent: #0f766e;
  --accent-2: #3b6ea8;
  --gold: #f0c85a;
  --danger: #a33434;
  --ok: #267348;
  --shadow: 0 14px 34px rgba(26, 39, 36, 0.08);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link,
.file-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-height: 38px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover,
.button-link:hover,
.file-button:hover {
  border-color: #9eb2aa;
  background: #f9fbfa;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.file-button input {
  display: none;
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px;
}

.host-page {
  overflow: hidden;
}

.host-page .shell {
  width: 100vw;
  max-width: none;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}

.top,
.player-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.host-page .top {
  margin-bottom: 0;
  min-height: 56px;
}

.top h1,
.player-top h1,
.join-panel h1 {
  margin: 0;
  font-size: 28px;
}

.top p,
.player-top p {
  margin: 4px 0 0;
  color: var(--muted);
}

.top-actions,
.control-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.host-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.05fr) minmax(340px, 1.05fr) minmax(280px, 0.9fr);
  grid-template-rows: minmax(0, 1.08fr) minmax(0, 0.92fr) minmax(132px, 20vh);
  grid-template-areas:
    "question ap players"
    "submissions submissions players"
    "logs logs logs";
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;
}

.host-page .panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel.wide {
  grid-column: auto;
}

.panel.host-question-area {
  grid-area: question;
}

.panel.host-ap-area {
  grid-area: ap;
}

.panel.host-players-area {
  grid-area: players;
}

.panel.host-submissions-area {
  grid-area: submissions;
}

.panel.host-logs-area {
  grid-area: logs;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1.25fr;
  gap: 12px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.panel-title h2 {
  margin: 0;
  font-size: 18px;
}

.compact-title {
  margin-bottom: 6px;
}

.compact-title h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

#phaseBadge {
  border: 1px solid #b6cbc4;
  background: #e8f3ef;
  color: var(--accent);
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.question-card,
.player-question {
  border: 1px solid var(--line);
  background: #fbfcfb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.question-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.question-card h3,
.player-question h2 {
  margin: 0 0 8px;
}

.ap-check-action {
  border: 1px solid #c8d3ce;
  border-radius: 6px;
  background: #f7faf9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-top: 12px;
}

.ap-check-action span {
  color: var(--muted);
  font-weight: 800;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.meta-row span {
  background: #edf3f8;
  color: #31596d;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.asset-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #f2f5f4;
  border-radius: 8px;
  min-height: 100px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
}

.asset-preview img,
.asset-preview video {
  max-width: 100%;
  max-height: 240px;
  display: block;
}

.asset-preview audio {
  width: calc(100% - 28px);
}

.revealed-hints {
  border: 1px solid #c8d3ce;
  border-left: 5px solid var(--accent-2);
  border-radius: 8px;
  background: #f7faf9;
  padding: 10px 12px;
  margin-top: 12px;
}

.revealed-hints h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.revealed-hints ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-weight: 700;
}

.answer-reveal {
  border: 1px solid #d5c784;
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px 12px;
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.answer-reveal h3,
.answer-reveal h4 {
  margin: 0;
  font-size: 14px;
}

.answer-reveal-content {
  color: var(--ink);
  font-weight: 700;
  min-width: 0;
}

.answer-reveal-content .asset-preview {
  margin-top: 0;
  background: white;
}

.answer-reveal-content p {
  margin: 8px 0 0;
  color: var(--muted);
}

.player-list,
.submission-list,
.history-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.player-list,
.submission-list {
  flex: 1 1 auto;
}

.player-row,
.submission-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.player-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.player-main > span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.player-main small {
  margin-left: 6px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.player-actions,
.player-gift {
  display: grid;
  gap: 8px;
}

.player-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.player-actions button {
  padding: 0 8px;
}

.player-gift {
  grid-template-columns: minmax(0, 1fr) auto;
}

.player-row strong,
.submission-row strong {
  min-width: 0;
}

.submission-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.submission-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.submission-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.submission-player {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.submission-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 2px 7px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.submission-answer {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.drawing-submission-row {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}

.drawing-result-wrap {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  overflow: hidden;
}

.drawing-submission-row .drawing-result {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.drawing-review-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.drawing-review-grid .drawing-submission-row {
  min-height: 100%;
}

.drawing-review-grid .drawing-submission-row > div:first-child {
  min-height: 72px;
}

.status-ok {
  color: var(--ok);
  font-weight: 800;
}

.status-wait {
  color: var(--muted);
  font-weight: 800;
}

.status-error {
  color: var(--danger);
  font-weight: 800;
}

.host-notice {
  border: 1px solid #e5a3a3;
  background: #fff1f1;
  color: var(--danger);
  border-radius: 6px;
  padding: 9px 10px;
  margin: 10px 0;
  font-weight: 800;
}

.ap-form {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.8fr) minmax(0, 0.8fr);
  gap: 8px;
  flex: 0 0 auto;
}

.ap-form .control-row {
  grid-column: 1 / -1;
}

.ap-details {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  flex: 0 0 auto;
}

.ap-stat {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  padding: 7px;
}

.ap-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ap-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.ap-slot-line,
.ap-error-line {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
}

.ap-error-line {
  border: 1px solid #e5a3a3;
  background: #fff1f1;
  color: var(--danger);
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 800;
}

.ap-next-lock {
  border: 1px solid #c8d3ce;
  border-left: 5px solid var(--accent-2);
  border-radius: 6px;
  background: #f7faf9;
  padding: 8px 10px;
  margin-top: 10px;
  display: grid;
  gap: 3px;
}

.ap-next-lock span {
  color: var(--muted);
  font-weight: 700;
}

.ap-progress {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  max-height: none;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.ap-question-row {
  width: 100%;
  min-height: 42px;
  justify-content: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  text-align: left;
  border-left-width: 5px;
}

.ap-question-row strong,
.ap-question-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-question-row span,
.ap-question-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  font-size: 12px;
}

.ap-question-row.is-current {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.ap-question-row.is-unlocked {
  border-left-color: var(--ok);
}

.ap-question-row.is-locked {
  border-left-color: var(--danger);
  background: #fff8f8;
}

.ap-question-row.is-checked,
.ap-question-row.is-pending {
  background: #fffbea;
}

.ap-question-row.is-pending {
  border-left-color: var(--gold);
}

.ap-question-row.is-confirmed {
  background: #f2fbf5;
}

.ap-question-row.is-confirmed {
  border-left-color: var(--ok);
}

.ap-audit-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  min-height: 0;
  overflow: auto;
}

.ap-audit-list li span {
  color: var(--ink);
  font-weight: 700;
}

.ap-audit-list small {
  display: block;
  color: var(--muted);
}

.history-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.log-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.log-column:first-child {
  border-left: 0;
  padding-left: 0;
}

.log-column .history-list,
.log-column .ap-audit-list {
  flex: 1 1 auto;
}

.player-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.join-panel,
.game-panel {
  width: min(760px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.game-panel {
  width: min(1500px, 100%);
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 900;
  margin-bottom: 12px;
}

#joinForm {
  display: grid;
  gap: 12px;
}

.score-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 150px;
  min-height: 72px;
  display: grid;
  place-items: center;
  background: #fffaf0;
  padding: 10px 12px;
}

.score-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-box strong {
  font-size: 28px;
}

.score-box small {
  color: var(--muted);
  font-weight: 800;
}

.answer-form {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.play-main,
.play-sidebar {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.play-sidebar {
  align-content: start;
}

.choice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 15px;
}

.choice-option input {
  width: 18px;
  min-height: 18px;
}

.chaos-shuffle .choice-option {
  position: relative;
  animation: shell-drift 0.62s ease-in-out infinite alternate;
  z-index: 2;
}

.chaos-shuffle .choice-option:nth-child(2n) {
  animation-name: shell-swerve;
  animation-delay: 0.08s;
}

.chaos-shuffle .choice-option:nth-child(3n) {
  animation-name: shell-hop;
  animation-delay: 0.16s;
}

@keyframes shell-drift {
  from {
    transform: translate(-36px, -10px) rotate(-6deg) scale(0.98);
  }
  to {
    transform: translate(42px, 14px) rotate(7deg) scale(1.04);
  }
}

@keyframes shell-swerve {
  from {
    transform: translate(48px, 18px) rotate(8deg);
  }
  to {
    transform: translate(-44px, -16px) rotate(-9deg);
  }
}

@keyframes shell-hop {
  from {
    transform: translate(-18px, 32px) rotate(4deg) scale(1.08);
  }
  to {
    transform: translate(24px, -28px) rotate(-5deg) scale(0.94);
  }
}

.drawing-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #fff 0, #fff 12px, #f0f4f2 12px, #f0f4f2 24px);
  display: grid;
  place-items: center;
  color: var(--muted);
}

.drawing-tools {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.drawing-tools label {
  min-width: 120px;
}

.drawing-tools input[type="range"] {
  padding-left: 0;
  padding-right: 0;
}

.drawing-tools button.is-active {
  background: #fff1f1;
  border-color: #d89a9a;
  color: var(--danger);
}

.pro-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pro-tools button.is-active {
  background: #fff7d6;
  border-color: var(--gold);
  color: var(--ink);
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(8, 28px);
  gap: 6px;
  align-self: center;
}

.color-swatch {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 2px solid #d1d9d5;
}

.color-swatch.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
}

.draw-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(32, 36, 38, 0.03);
}

.player-drawing-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.drawing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.drawing-card.is-winner {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 200, 90, 0.25);
}

.drawing-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.drawing-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display: block;
}

.drawing-image-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  overflow: hidden;
}

.drawing-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.end-screen {
  display: grid;
  gap: 16px;
}

.end-screen h2 {
  margin: 0;
}

.final-standings {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.final-standings li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px;
}

.final-standings > li > span {
  color: var(--accent);
  font-weight: 900;
}

.final-standings strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.final-standings em {
  align-self: center;
  white-space: nowrap;
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.achievement-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.achievement-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.achievement-card p {
  margin: 0;
  color: var(--muted);
}

.name-glow {
  text-shadow: 0 0 8px rgba(240, 200, 90, 0.9), 0 0 14px rgba(20, 184, 166, 0.55);
  animation: name-pulse 1.1s ease-in-out infinite alternate;
}

.name-rainbow .name-text {
  color: #ef4444;
  animation: rainbow-name 2.4s linear infinite;
}

.name-fancy .name-text {
  font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive;
  letter-spacing: 0;
}

.decorated-name.name-bold .name-text {
  font-weight: 950;
}

.name-italic .name-text {
  font-style: italic;
}

@keyframes name-pulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.35);
  }
}

@keyframes rainbow-name {
  0% {
    color: #ef4444;
  }
  18% {
    color: #f97316;
  }
  34% {
    color: #facc15;
  }
  50% {
    color: #22c55e;
  }
  66% {
    color: #38bdf8;
  }
  82% {
    color: #7c3aed;
  }
  100% {
    color: #ec4899;
  }
}

.leaderboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
  padding-left: 24px;
}

.leaderboard li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-width: 0;
  line-height: 1.25;
  padding-block: 4px;
}

.leaderboard-name {
  min-width: 0;
}

.leaderboard .decorated-name {
  font-size: 20px;
}

.leaderboard-score {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  justify-self: end;
  white-space: nowrap;
}

.leaderboard-artifacts {
  grid-column: 1 / -1;
  min-width: 0;
}

.leaderboard .hat-icon {
  width: 1.45em;
  height: 1.45em;
}

.player-main .decorated-name,
.leaderboard .decorated-name,
.final-standings .decorated-name {
  align-items: flex-start;
}

.player-main .decorated-name .name-text,
.leaderboard .decorated-name .name-text,
.final-standings .decorated-name .name-text {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  text-overflow: clip;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.15;
}

.shop-panel,
.inventory-panel,
.leaderboard-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
  margin-bottom: 0;
}

.shop-panel h2,
.inventory-panel h2,
.leaderboard-panel h2 {
  margin: 0 0 10px;
}

.shop-offers,
.inventory-list {
  display: grid;
  gap: 10px;
}

.shop-offers {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.shop-card,
.inventory-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.shop-card {
  grid-template-columns: 58px minmax(220px, 1fr) auto;
  align-items: start;
}

.shop-card img,
.inventory-item img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.shop-card img {
  width: 50px;
  height: 50px;
}

.artifact-strip img {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  object-fit: cover;
}

.shop-card h3,
.inventory-item h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.shop-card p,
.inventory-item p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.shop-card small {
  color: var(--accent-2);
  font-weight: 800;
}

.item-use-controls {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.artifact-strip {
  display: inline-flex;
  gap: 3px;
  margin-left: 8px;
  vertical-align: middle;
  flex-wrap: wrap;
}

.artifact-strip img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.decorated-name {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  position: relative;
  isolation: isolate;
  vertical-align: middle;
  padding-top: 0.85em;
  margin-top: -0.45em;
}

.decorated-name .name-text {
  min-width: 0;
  max-width: 100%;
  display: inline-block;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hat-stack {
  position: absolute;
  left: 0.25em;
  top: 0;
  width: 2.7em;
  height: 1.55em;
  pointer-events: none;
  z-index: 2;
}

.hat-icon {
  position: absolute;
  left: calc(var(--hat-index, 0) * 0.48em);
  top: calc(var(--hat-index, 0) * -0.13em);
  width: 1.35em;
  height: 1.35em;
  object-fit: contain;
  transform: rotate(calc(-10deg + var(--hat-index, 0) * 8deg));
  filter: drop-shadow(0 2px 2px rgba(32, 36, 38, 0.18));
}

.achievement-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 7px 0;
}

.achievement-player,
.achievement-more {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf9;
  padding: 4px 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.achievement-player .hat-icon {
  width: 1.25em;
  height: 1.25em;
}

@media (max-width: 900px) {
  .host-page {
    overflow: auto;
  }

  .host-page .shell {
    height: auto;
    min-height: 100vh;
  }

  .host-grid,
  .panel.wide {
    grid-template-areas: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-column: auto;
  }

  .player-layout {
    grid-template-columns: 1fr;
  }

  .shop-offers {
    grid-template-columns: 1fr;
  }

  .shop-card {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .shop-card button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .host-question-area,
  .host-ap-area,
  .host-players-area,
  .host-submissions-area,
  .host-logs-area {
    grid-area: auto;
  }

  .host-logs-area {
    grid-template-columns: 1fr;
  }

  .top,
  .player-top,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .player-row,
  .submission-row {
    grid-template-columns: 1fr;
  }

  .ap-check-action {
    align-items: stretch;
    flex-direction: column;
  }

  .ap-details,
  .ap-question-row,
  .ap-form,
  .player-actions,
  .player-gift {
    grid-template-columns: 1fr;
  }

  .ap-form .control-row {
    grid-column: auto;
  }

  .log-column {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 10px;
  }

  .log-column:first-child {
    border-top: 0;
    padding-top: 0;
  }
}
