:root {
  --blue: #2f78ff;
  --sky: #8cdbff;
  --ink: #171717;
  --yellow: #ffe500;
  --paper: #fffdf5;
  --muted: #5b6777;
  --red: #ff6b72;
  --green: #69e98d;
  --card-blue: #65c9ff;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Arial Rounded MT Bold", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #1c3768;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.6;
}

#app {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.phone {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 255, 255, 0.18) 0 60px, transparent 62px),
    linear-gradient(180deg, #2f78ff 0%, #69bdff 40%, #9be9f4 78%, #ffd9b7 100%);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

.phone::before,
.phone::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.phone::before {
  left: -70px;
  right: -50px;
  bottom: -26px;
  height: 176px;
  background: url("assets/landscape.svg") center bottom / cover no-repeat;
}

.phone::after {
  inset: 0;
  background:
    linear-gradient(110deg, transparent 0 44%, rgba(255, 255, 255, 0.1) 45% 53%, transparent 54%),
    radial-gradient(circle at 48% 22%, rgba(255, 255, 255, 0.12), transparent 22%);
  mix-blend-mode: screen;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 36px 22px calc(28px + var(--safe-bottom));
}

.topbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 3px solid transparent;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  display: grid;
  place-items: center;
  font-size: 25px;
  font-weight: 900;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.top-spacer {
  width: 42px;
  flex: 0 0 42px;
}

.logo {
  width: min(82vw, 340px);
  margin: 64px auto 70px;
  display: block;
}

.subtitle {
  display: none;
  margin: 0;
}

.create-count {
  color: #2c3542;
  font-weight: 900;
  font-size: 20px;
}

.create-count span {
  color: #2c3542;
  font-size: 56px;
  line-height: 1;
}

.config-note {
  color: #3a4652;
  line-height: 1.55;
  font-weight: 800;
  text-align: center;
  margin: 14px 4px;
}

.role-emoji {
  display: block;
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.2));
}

.range {
  width: 100%;
  height: 34px;
  accent-color: #ffe500;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: #52606f;
  font-size: 13px;
  font-weight: 900;
}

.hero-agent {
  position: absolute;
  right: -36px;
  bottom: -2px;
  z-index: 1;
  width: 142px;
  opacity: 0.96;
  pointer-events: none;
}

.home-actions {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 14px;
  max-width: 340px;
  margin: 0 auto;
}

.panel {
  background: rgba(255, 255, 255, 0.72);
  border: 4px solid #111;
  border-radius: 8px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.18);
  padding: 16px;
}

.input,
.select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 3px solid #111;
  border-radius: 8px;
  background: #fff;
  color: #222;
  outline: 0;
}

.input:focus,
.select:focus {
  box-shadow: 0 0 0 4px rgba(255, 229, 0, 0.42);
}

.field {
  display: grid;
  gap: 8px;
  color: #26364a;
  font-weight: 800;
}

.field + .field {
  margin-top: 12px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 58px;
  padding: 0 22px;
  border: 4px solid #111;
  border-radius: 11px;
  box-shadow: 0 5px 0 #111;
  font-weight: 900;
  font-size: 24px;
  color: #222;
}

.primary-btn {
  background: linear-gradient(180deg, #fff200, #ffd800);
}

.secondary-btn {
  background: #fffdf5;
}

.danger-btn {
  background: #ff7676;
  color: #111;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.page-title {
  margin: 8px 0 18px;
  text-align: center;
  color: #fff;
  font-size: 34px;
  font-weight: 500;
}

.section-title {
  margin: 18px 0 12px;
  color: #fff;
  font-size: 24px;
  text-align: center;
  font-weight: 500;
}

.section-title.dark {
  color: #2c3542;
  font-weight: 900;
}

.create-role-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.role-card {
  min-height: 126px;
  background: var(--card-blue);
  border: 4px solid #111;
  border-radius: 12px;
  padding: 8px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.18);
}

.role-card.red {
  background: #ff7075;
}

.role-card.green {
  background: #6df0a0;
}

.role-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.role-name {
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  border-radius: 18px;
  padding: 4px 10px;
  font-weight: 900;
}

.stepper-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(74px, 1fr) 44px 54px 44px;
  align-items: center;
  gap: 8px;
  color: #26364a;
  font-weight: 900;
}

.stepper-row + .stepper-row {
  margin-top: 6px;
}

.stepper-row button {
  height: 44px;
  border: 3px solid #111;
  background: #ffe500;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
}

.stepper-row strong {
  min-width: 0;
  text-align: center;
  font-size: 28px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.paper-choice {
  position: relative;
  min-height: 84px;
  padding: 12px 6px;
  border: 3px solid #111;
  background: #fff;
  border-radius: 6px 6px 18px 6px;
  color: #555;
  font-size: 17px;
  font-weight: 800;
}

.paper-choice.selected::after {
  content: "✓";
  position: absolute;
  right: 7px;
  bottom: 6px;
  color: #e72e36;
  font-size: 30px;
  font-weight: 900;
}

.hint {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.55;
  font-weight: 700;
}

.room-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 152px;
  min-height: 48px;
  padding: 0 16px;
  border: 4px solid #111;
  border-radius: 8px;
  background: #fff;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 3px;
}

.center {
  text-align: center;
}

.player-list {
  display: grid;
  gap: 8px;
}

.player-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 3px solid #111;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.player-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 2px solid #111;
  border-radius: 999px;
  background: #ffe500;
  font-size: 12px;
  font-weight: 900;
}

.badge.muted {
  background: #e8edf2;
}

.badge.red {
  background: #ff8181;
}

.badge.green {
  background: #7ff0a4;
}

.out-status {
  color: #d71920;
  font-weight: 900;
}

.word-card {
  position: relative;
  min-height: 178px;
  display: grid;
  place-items: center;
  text-align: center;
  background: #fffdf5;
  border: 5px solid #111;
  border-radius: 10px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.22);
  padding: 18px;
  overflow: hidden;
}

.word-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px dashed rgba(0, 0, 0, 0.14);
  border-radius: 8px;
}

.word-card > * {
  position: relative;
}

.word {
  font-size: 42px;
  font-weight: 900;
  color: #111;
}

.role-big {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 900;
  color: #334;
}

.status-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #223;
  line-height: 1.45;
}

.vote-options {
  display: grid;
  gap: 10px;
}

.vote-option {
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 3px solid #111;
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.vote-option.selected {
  background: #ffe500;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.3);
}

.stats {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.bar {
  height: 14px;
  border: 2px solid #111;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: #ffe500;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 20;
  width: min(86vw, 340px);
  transform: translateX(-50%);
  padding: 12px 14px;
  border: 3px solid #111;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
  text-align: center;
  font-weight: 900;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.42);
}

.modal {
  width: min(100%, 360px);
  max-height: min(82vh, 720px);
  overflow: auto;
  background: #fffdf5;
  border: 4px solid #111;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.28);
}

.modal h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.modal p {
  line-height: 1.55;
}

.modal-note {
  margin: 0 0 12px;
  color: #4d5966;
  font-weight: 800;
}

.modal-wait {
  color: #3d4754;
  text-align: center;
}

.vote-modal .vote-options {
  max-height: 46vh;
  overflow: auto;
  padding-right: 2px;
}

.rules {
  color: #223;
  line-height: 1.65;
}

.rules h2 {
  margin: 10px 0 8px;
}

.empty-space {
  height: 94px;
}

@media (min-width: 700px) {
  #app {
    padding: 24px 0;
  }

  .phone {
    min-height: 932px;
    border-radius: 24px;
  }
}
