:root {
  color-scheme: light;
  --bg: #f4efe6;
  --ink: #14314e;
  --accent: #dd6d4a;
  --accent-soft: #f5c9ae;
  --panel: rgba(255, 251, 244, 0.92);
  --line: rgba(20, 49, 78, 0.12);
  --shadow: 0 24px 60px rgba(42, 33, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(245, 201, 174, 0.76), transparent 26%),
    radial-gradient(circle at bottom right, rgba(20, 49, 78, 0.13), transparent 22%),
    linear-gradient(135deg, #faf6ef, var(--bg));
}

.page-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  margin-bottom: 24px;
}

.compact-hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  line-height: 1.05;
  font-size: clamp(2rem, 3vw, 3.8rem);
}

.lead {
  max-width: 60rem;
  font-size: 1.02rem;
  line-height: 1.7;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}

.admin-layout {
  display: grid;
  max-width: 460px;
  margin: 0 auto;
}

.issuer-layout {
  grid-template-columns: minmax(360px, 460px) minmax(420px, 1fr);
  gap: 20px;
  max-width: 1040px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.control-panel,
.cloud-panel {
  padding: 24px;
}

.panel-header h2,
.panel-header p {
  margin: 0;
}

.panel-header p {
  margin-top: 8px;
  line-height: 1.6;
  color: rgba(20, 49, 78, 0.74);
}

.stack-form {
  margin-top: 18px;
}

.stack-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.stack-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(20, 49, 78, 0.16);
  border-radius: 16px;
  background: #fffefa;
  font-size: 1rem;
}

.form-row {
  display: flex;
  gap: 10px;
}

.stack-form button,
.ghost-button {
  margin-top: 10px;
  padding: 14px 16px;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.ghost-button {
  margin-top: 0;
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(20, 49, 78, 0.16);
}

.ghost-button.is-active {
  background: rgba(221, 109, 74, 0.12);
  border-color: rgba(221, 109, 74, 0.38);
  color: var(--accent);
}

.stack-form button:hover,
.ghost-button:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.mode-control {
  margin-top: 18px;
}

.mode-control-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(20, 49, 78, 0.78);
  font-size: 0.92rem;
  font-weight: 800;
}

.mode-actions {
  margin-top: 0;
}

.export-control {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.export-control .ghost-button {
  width: 100%;
}

.export-control .field-note {
  margin: 10px 0 6px;
}

.participant-title {
  display: grid;
  gap: 4px;
}

.participant-title strong {
  font-size: 1.08em;
}

.field-note {
  margin: -6px 0 2px;
  color: rgba(20, 49, 78, 0.66);
  font-size: 0.86rem;
}

.acceptance-notice {
  margin: 8px 0 0;
  color: var(--accent);
  font-weight: 800;
}

.is-hidden {
  display: none !important;
}

.room-info {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(20, 49, 78, 0.06);
}

.status {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: rgba(20, 49, 78, 0.72);
}

.issuer-result {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.issuer-result h3 {
  margin: 0 0 4px;
}

.issuer-result label {
  font-size: 0.86rem;
  font-weight: 800;
}

.issuer-result input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(20, 49, 78, 0.16);
  border-radius: 12px;
  background: #fffefa;
  color: var(--ink);
  font-size: 0.82rem;
}

.issuer-list-panel {
  min-height: 360px;
}

.issuer-list-panel label {
  display: block;
  margin-top: 18px;
  margin-bottom: 8px;
  font-weight: 700;
}

.issuer-list-password {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(20, 49, 78, 0.16);
  border-radius: 16px;
  background: #fffefa;
  font-size: 1rem;
}

.issuer-refresh-button {
  width: 100%;
  margin-top: 18px;
}

.issuer-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.issuer-list-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(20, 49, 78, 0.12);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.72);
}

.issuer-list-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.issuer-list-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.issuer-status-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.issuer-status-badge.is-active {
  background: rgba(18, 128, 83, 0.12);
  color: #08724a;
}

.issuer-status-badge.is-expired {
  background: rgba(121, 83, 57, 0.12);
  color: #795339;
}

.issuer-list-meta {
  margin: 0;
  color: rgba(20, 49, 78, 0.66);
  font-size: 0.9rem;
}

.issuer-list-item label {
  font-size: 0.82rem;
  font-weight: 800;
}

.issuer-list-item input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(20, 49, 78, 0.14);
  border-radius: 12px;
  background: #fffefa;
  color: var(--ink);
  font-size: 0.78rem;
}

.issuer-list-links {
  display: flex;
  gap: 8px;
}

.issuer-list-links .ghost-button {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
}

.danger-button {
  color: #a23f2d;
  border-color: rgba(162, 63, 45, 0.28);
  background: rgba(162, 63, 45, 0.06);
}

.danger-button:hover {
  background: rgba(162, 63, 45, 0.1);
}

.cloud {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(20, 49, 78, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(255, 245, 237, 0.96)),
    radial-gradient(circle at center, rgba(245, 201, 174, 0.36), transparent 45%);
}

.screen-cloud {
  min-height: calc(100vh - 230px);
}

.screen-cloud::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 0;
  width: clamp(210px, 28vw, 420px);
  aspect-ratio: 1;
  background: url("/assets/kaigo-sapuri-background-logo.png") center / contain no-repeat;
  opacity: 0.22;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.word-chip {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  line-height: 1.18;
  white-space: nowrap;
  color: #17324d;
  transform: translate(-50%, -50%) rotate(var(--rotate));
  animation: pop-in 240ms ease;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(255, 251, 244, 0.45);
  padding: 0.14em 0.18em;
}

.raw-chip {
  max-width: min(34rem, 86%);
  white-space: normal;
  text-align: center;
  font-weight: 700;
  line-height: 1.35;
}

.token-chip {
  white-space: nowrap;
}

.stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.stat-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.84rem;
  color: rgba(20, 49, 78, 0.7);
}

.screen-page .page-shell {
  width: min(1540px, calc(100vw - 12px));
}

.screen-panel {
  padding: 12px;
}

.screen-page .compact-hero {
  margin-bottom: 10px;
}

.screen-page .compact-hero .lead {
  margin: 8px 0 0;
}

.screen-page .room-info {
  margin-top: 0;
}

.screen-title-bar {
  max-width: min(980px, 100%);
  padding: 10px 18px 10px 12px;
  border-radius: 18px;
  gap: 14px;
}

.screen-logo {
  width: clamp(52px, 6vw, 88px);
  height: clamp(52px, 6vw, 88px);
  object-fit: contain;
  flex: 0 0 auto;
}

.screen-title-label {
  font-size: 0.92rem;
}

.screen-title-bar strong {
  font-size: clamp(1.6rem, 3vw, 3rem);
  line-height: 1.1;
}

.participant-qr-card {
  position: fixed;
  top: clamp(12px, 1.8vw, 26px);
  right: clamp(14px, 2vw, 32px);
  z-index: 22;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: clamp(118px, 10vw, 164px);
  padding: 10px;
  border: 1px solid rgba(20, 49, 78, 0.14);
  border-radius: 14px;
  background: rgba(255, 251, 244, 0.92);
  box-shadow: 0 16px 34px rgba(20, 49, 78, 0.12);
  cursor: pointer;
  transition:
    top 220ms ease,
    right 220ms ease,
    width 220ms ease,
    padding 220ms ease,
    transform 220ms ease,
    box-shadow 220ms ease;
}

.participant-qr-card:focus-visible {
  outline: 4px solid rgba(221, 109, 74, 0.38);
  outline-offset: 4px;
}

.participant-qr-card.is-expanded {
  top: 50%;
  right: 50%;
  z-index: 42;
  width: clamp(240px, 28vw, 420px);
  padding: clamp(14px, 1.6vw, 22px);
  transform: translate(50%, -50%);
  box-shadow: 0 28px 80px rgba(20, 49, 78, 0.3);
}

.participant-qr-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 49, 78, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.participant-qr-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.participant-qr-card span {
  color: rgba(20, 49, 78, 0.76);
  font-size: 0.82rem;
  font-weight: 800;
}

.participant-qr-card.is-expanded span {
  font-size: clamp(0.95rem, 1.3vw, 1.2rem);
}

.participant-qr-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
}

.participant-qr-card small {
  max-width: 100%;
  overflow: hidden;
  color: rgba(20, 49, 78, 0.68);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-qr-card.is-expanded small {
  font-size: clamp(0.7rem, 1vw, 0.92rem);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82) rotate(var(--rotate));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(var(--rotate));
  }
}

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

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

  .cloud {
    min-height: 420px;
  }

  .form-row,
  .action-row,
  .stats {
    flex-direction: column;
  }
}
