:root {
  --ink: #17120f;
  --night: #111827;
  --night-soft: #1f2937;
  --ivory: #f7f0df;
  --paper: #fffaf0;
  --gold: #c99b43;
  --gold-dark: #8c6729;
  --blood: #8f2634;
  --indigo: #263f70;
  --green: #3f6f4e;
  --line: rgba(255, 250, 240, 0.22);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  color: var(--ivory);
  background: #14100e;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ivory);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(9, 11, 16, 0.82), rgba(33, 18, 18, 0.62)),
    url("../Gemini_Generated_Image_26mtsc26mtsc26mt.png") center / cover fixed;
}

.table-surface {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(150px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
}

.top-bar,
.section-heading,
.cloth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-bar h1,
.section-heading h2,
.cloth-header h2,
.panel-block h2,
.modal-panel h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.top-bar h1 {
  font-size: 1.65rem;
}

.section-heading h2,
.cloth-header h2,
.panel-block h2 {
  font-size: 1.15rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: #d8b66b;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

select,
.button {
  min-height: 38px;
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--ivory);
  background: rgba(17, 24, 39, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

select {
  max-width: 100%;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
}

.button:hover:not(:disabled),
.card:hover,
.choice-card:hover {
  border-color: rgba(255, 232, 176, 0.65);
  transform: translateY(-1px);
}

.button:focus-visible,
.card:focus-visible,
.choice-card:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(255, 212, 112, 0.75);
  outline-offset: 2px;
}

.button.accent {
  background: linear-gradient(135deg, #b9822f, #7e2331);
  border-color: rgba(255, 233, 178, 0.45);
}

.button.danger {
  background: linear-gradient(135deg, #8f2634, #3b1118);
  border-color: rgba(255, 210, 210, 0.38);
}

.button.secondary {
  background: rgba(255, 250, 240, 0.1);
}

.button.full {
  width: 100%;
}

.meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.meters article {
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.62);
}

.meters span,
.meters small {
  display: block;
  color: rgba(255, 250, 240, 0.72);
}

.meters strong {
  display: inline-block;
  margin-top: 4px;
  font-size: 1.42rem;
  line-height: 1;
  color: #ffd77e;
}

.cloth-board {
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(255, 250, 240, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(38, 63, 112, 0.74), rgba(72, 23, 45, 0.78)),
    url("../Gemini_Generated_Image_fqe939fqe939fqe9.png") center / cover;
  box-shadow: var(--shadow);
}

.turn-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(255, 250, 240, 0.26);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.74);
  box-shadow: var(--shadow);
}

.turn-banner h2 {
  margin: 0;
  font-size: 1.2rem;
}

.turn-banner p:last-child {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 250, 240, 0.84);
  line-height: 1.35;
}

.compact h2 {
  font-size: 1.05rem;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.player-board {
  min-height: 138px;
  border: 1px solid rgba(255, 250, 240, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.58);
}

.player-board.is-active {
  border-color: #ffd77e;
  box-shadow: 0 0 0 2px rgba(255, 215, 126, 0.16);
}

.player-board.is-human {
  background: rgba(64, 45, 34, 0.7);
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.player-head strong,
.player-head span {
  display: block;
}

.player-head span {
  margin-top: 3px;
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.78rem;
}

.opponent-hand,
.tissu-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-height: 34px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.opponent-hand {
  margin-bottom: 10px;
}

.hand-back,
.table-card,
.target-card {
  border: 1px solid rgba(255, 250, 240, 0.22);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(17, 24, 39, 0.78);
}

.hand-back {
  flex: 0 0 52px;
  min-height: 32px;
  padding: 6px;
  font-size: 0.72rem;
  font-weight: 800;
}

.hand-back.visible {
  background: rgba(184, 126, 48, 0.74);
}

.table-card {
  flex: 0 0 78px;
  min-height: 66px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  text-align: left;
}

.table-card span,
.table-card em {
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.66rem;
  font-style: normal;
  text-transform: uppercase;
}

.table-card strong {
  font-size: 0.78rem;
  line-height: 1.1;
}

.table-card.bazin {
  background: linear-gradient(160deg, rgba(25, 61, 96, 0.92), rgba(67, 103, 78, 0.78));
}

.table-card.curse {
  background: linear-gradient(160deg, rgba(52, 17, 24, 0.96), rgba(15, 23, 42, 0.88));
}

.table-card.protected {
  border-color: #ffd77e;
  box-shadow: inset 0 0 0 2px rgba(255, 215, 126, 0.18);
}

.empty-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px dashed rgba(255, 250, 240, 0.22);
  border-radius: 8px;
  padding: 7px 9px;
  color: rgba(255, 250, 240, 0.66);
  font-size: 0.76rem;
}

.played-card-zone {
  min-height: 122px;
  display: grid;
  place-items: center;
  margin-top: 14px;
}

.played-card {
  width: min(260px, 100%);
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 250, 240, 0.28);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  background: rgba(15, 23, 42, 0.82);
}

.played-card.hidden-card {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 215, 126, 0.24), transparent 42%),
    linear-gradient(160deg, #172036, #541b28);
}

.played-card strong {
  font-size: 1.3rem;
}

.played-card span,
.played-card p {
  margin: 0;
  color: rgba(255, 250, 240, 0.78);
}

.target-zone {
  margin-top: 16px;
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: rgba(9, 11, 16, 0.62);
}

.target-zone.is-hidden,
.announce-block.is-hidden,
.is-hidden {
  display: none;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.target-card {
  min-height: 48px;
  padding: 10px;
  text-align: left;
  font-weight: 800;
}

.target-card:hover,
.hand-back:hover,
.table-card:hover {
  border-color: #ffd77e;
}

.announce-block {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.announce-block label {
  font-weight: 800;
  color: #4f351c;
}

.announce-block select {
  color: var(--paper);
  background: #2f3544;
}

.tokens {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tokens span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 250, 240, 0.24);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(17, 24, 39, 0.58);
  font-size: 0.82rem;
  font-weight: 800;
}

.legacy-row {
  min-height: 140px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.board-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.board-columns h3 {
  margin: 0 0 8px;
  color: rgba(255, 250, 240, 0.82);
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mini-pile {
  min-height: 116px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid rgba(255, 250, 240, 0.18);
  border-radius: 8px;
  padding: 10px;
  background: rgba(11, 18, 32, 0.48);
}

.mini-card {
  flex: 0 0 82px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 250, 240, 0.26);
  border-radius: 8px;
  padding: 8px;
  color: var(--paper);
  background: rgba(20, 24, 31, 0.84);
}

.mini-card strong {
  font-size: 0.78rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.mini-card span {
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.68rem;
  line-height: 1.1;
}

.hand-zone {
  min-height: 0;
  overflow: hidden;
}

.hand {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 8px;
  margin-top: 8px;
  min-height: 0;
}

.card,
.choice-card,
.empty-state {
  border: 1px solid rgba(255, 250, 240, 0.24);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(255, 250, 240, 0.12);
}

.card {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 9px;
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.card.is-selected {
  border-color: #ffd77e;
  background: rgba(255, 215, 126, 0.18);
}

.card .type,
.choice-card .type {
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card .name,
.choice-card .name {
  margin: 8px 0;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.card .effect,
.choice-card .effect {
  color: rgba(255, 250, 240, 0.78);
  font-size: 0.74rem;
  line-height: 1.25;
}

.card .tag {
  align-self: flex-start;
  margin-top: 10px;
  border-radius: 999px;
  padding: 5px 8px;
  color: #1c1712;
  background: #ffd77e;
  font-size: 0.72rem;
  font-weight: 900;
}

.card.character {
  background: linear-gradient(160deg, rgba(41, 55, 77, 0.92), rgba(119, 78, 35, 0.72));
}

.card.bazin,
.mini-card.bazin {
  background: linear-gradient(160deg, rgba(25, 61, 96, 0.92), rgba(67, 103, 78, 0.78));
}

.card.curse,
.mini-card.curse {
  background: linear-gradient(160deg, rgba(52, 17, 24, 0.96), rgba(15, 23, 42, 0.88));
}

.card.heritage {
  background: linear-gradient(160deg, rgba(121, 36, 49, 0.92), rgba(203, 156, 67, 0.72));
}

.empty-state {
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 12px;
  color: rgba(255, 250, 240, 0.72);
  text-align: center;
}

.side-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100vh;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 250, 240, 0.14);
  padding: 14px;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 250, 240, 0.9), rgba(248, 235, 204, 0.92)),
    url("../Gemini_Generated_Image_7obypl7obypl7oby(1).png") center / cover;
}

.panel-block {
  border: 1px solid rgba(23, 18, 15, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 250, 240, 0.86);
  box-shadow: 0 10px 26px rgba(43, 29, 18, 0.12);
}

.panel-block .eyebrow {
  color: var(--gold-dark);
}

.panel-block p {
  line-height: 1.42;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.side-panel .button,
.side-panel select {
  color: var(--paper);
  background: #2f3544;
}

.side-panel .button.secondary {
  background: #6c4a35;
}

.choice-block.is-hidden,
.modal.is-hidden {
  display: none;
}

.choice-cards {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.choice-card {
  width: 100%;
  min-height: 96px;
  padding: 10px;
  color: var(--paper);
  background: linear-gradient(160deg, rgba(38, 63, 112, 0.95), rgba(143, 38, 52, 0.82));
  text-align: left;
}

.rules-block ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.rules-block li {
  margin: 8px 0;
  line-height: 1.32;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 44vh;
  overflow-y: auto;
  padding-right: 2px;
}

.log-entry {
  border-left: 3px solid var(--gold);
  padding: 7px 8px;
  color: #2d221a;
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.86rem;
  line-height: 1.3;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 10, 15, 0.74);
  z-index: 20;
}

.modal-panel {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 250, 240, 0.26);
  border-radius: 8px;
  padding: 22px;
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(86, 24, 35, 0.94)),
    url("../Gemini_Generated_Image_i53hgdi53hgdi53h(1).png") center / cover;
  box-shadow: var(--shadow);
}

.modal-panel p {
  line-height: 1.45;
}

.outcome-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 18px 0;
}

.outcome-stats div {
  border-top: 1px solid rgba(255, 250, 240, 0.2);
  padding-top: 8px;
}

.outcome-stats dt {
  color: rgba(255, 250, 240, 0.68);
  font-size: 0.78rem;
}

.outcome-stats dd {
  margin: 3px 0 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.online-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.online-form input {
  min-height: 38px;
  width: 140px;
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ivory);
  background: rgba(17, 24, 39, 0.78);
}

.experience-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(rgba(7, 10, 18, 0.7), rgba(25, 10, 14, 0.82)),
    url("../Gemini_Generated_Image_i53hgdi53hgdi53h(1).png") center / cover;
}

.experience-overlay.is-hidden {
  display: none;
}

.experience-panel {
  width: min(680px, 100%);
  max-height: min(760px, 88vh);
  overflow: auto;
  border: 1px solid rgba(255, 235, 181, 0.35);
  border-radius: 8px;
  padding: 24px;
  color: var(--paper);
  background: rgba(13, 18, 31, 0.9);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(rgba(11, 14, 24, 0.16), rgba(11, 14, 24, 0.9)),
    url("../Gemini_Generated_Image_26mtsc26mtsc26mt.png") center / cover;
}

.experience-panel h2 {
  margin: 0;
  font-size: 3.2rem;
  line-height: 1;
}

.experience-panel p {
  max-width: 680px;
  line-height: 1.45;
}

.wide-panel {
  width: min(980px, 100%);
}

.panel-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-headline h2 {
  font-size: 2rem;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manual-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.manual-reader {
  max-height: min(560px, 62vh);
  overflow: auto;
  border: 1px solid rgba(255, 250, 240, 0.16);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 250, 240, 0.08);
}

.manual-reader h2,
.manual-reader h3,
.manual-reader h4 {
  margin: 18px 0 8px;
  color: #ffd77e;
  line-height: 1.1;
}

.manual-reader h2:first-child,
.manual-reader h3:first-child {
  margin-top: 0;
}

.manual-reader h2 {
  font-size: 1.8rem;
}

.manual-reader h3 {
  font-size: 1.25rem;
}

.manual-reader h4 {
  font-size: 1rem;
}

.manual-reader p,
.manual-reader li {
  max-width: 78ch;
  margin: 8px 0;
  color: rgba(255, 250, 240, 0.9);
  line-height: 1.5;
}

.manual-reader ol {
  margin: 12px 0;
  padding-left: 24px;
}

.manual-reader strong {
  color: #fff1c7;
}

.manual-bullet {
  position: relative;
  padding-left: 18px;
}

.manual-bullet::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffd77e;
}

.loading-text {
  color: rgba(255, 250, 240, 0.75);
  font-style: italic;
}

.manual-grid article,
.credits-list p {
  border: 1px solid rgba(255, 250, 240, 0.16);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 250, 240, 0.08);
}

.manual-grid h3 {
  margin: 0 0 8px;
  color: #ffd77e;
}

.manual-grid p,
.credits-list p {
  margin: 0;
}

.credits-list {
  display: grid;
  gap: 10px;
}

.credits-list strong,
.credits-list span {
  display: block;
}

.credits-list span {
  margin-top: 5px;
  color: rgba(255, 250, 240, 0.78);
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    max-height: none;
    border-left: 0;
    border-top: 1px solid rgba(255, 250, 240, 0.14);
  }
}

@media (max-width: 720px) {
  .table-surface,
  .side-panel {
    padding: 16px;
  }

  .top-bar,
  .section-heading,
  .cloth-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions > *,
  .section-heading .button {
    width: 100%;
  }

  .meters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-columns {
    grid-template-columns: 1fr;
  }

  .hand {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .manual-grid {
    grid-template-columns: 1fr;
  }

  .experience-panel h2 {
    font-size: 2.3rem;
  }

  .manual-tabs .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .meters {
    grid-template-columns: 1fr;
  }

  .top-bar h1 {
    font-size: 1.55rem;
  }

  .experience-panel h2 {
    font-size: 1.9rem;
  }
}
