:root {
  --bg: #0b1021;
  --panel: #11172c;
  --accent: #f2b705;
  --muted: #92a1c6;
  --text: #e8edff;
  --danger: #e4572e;
  --success: #2fbf71;
  --shadow: 0 14px 45px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-family: var(--font);
  background: radial-gradient(circle at 20% 20%, rgba(242, 183, 5, 0.1), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(47, 191, 113, 0.12), transparent 28%),
    radial-gradient(circle at 50% 80%, rgba(228, 87, 46, 0.12), transparent 32%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.page.webapp {
  max-width: 520px;
  text-align: center;
}

.webapp header {
  text-align: center;
}

header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 10px 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.top-bar.single-line {
  flex-wrap: nowrap;
  gap: 10px;
}

.top-bar.single-line > * {
  flex: 0 0 auto;
}

.top-bar.single-line button:not(.icon-btn) {
  width: auto;
  padding: 10px 14px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: clamp(14px, 1.2vw, 18px);
}

@media (min-width: 1024px) {
  .top-bar.single-line {
    flex-wrap: nowrap;
  }
  .top-bar.single-line > * {
    flex: 0 0 auto;
  }
  .top-bar.single-line button:not(.icon-btn) {
    width: auto;
    min-width: 180px;
  }
}

@media (max-width: 480px) {
  .top-bar.single-line {
    flex-wrap: wrap;
    gap: 6px;
  }
  .top-bar.single-line .link-chip {
    flex: 1 1 48%;
    max-width: 48%;
    min-width: 0;
    font-size: clamp(11px, 2.6vw, 12px);
    padding: 4px 6px;
  }
  .top-bar.single-line .link-label {
    font-size: clamp(11px, 2.6vw, 12px);
  }
  .top-bar.single-line button:not(.icon-btn) {
    flex: 1 1 100%;
    min-width: 0;
    width: auto;
    height: 42px;
    padding: 10px 12px;
    font-size: clamp(14px, 3.6vw, 17px);
  }
  .top-bar.single-line .icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
  max-width: 32px;
  transform: scale(1.05);
}
  .top-bar.single-line > .link-chip:nth-of-type(1) { order: 1; }
  .top-bar.single-line > .link-chip:nth-of-type(2) { order: 2; }
  .top-bar.single-line > #randomBtn { order: 3; }
  .top-bar.single-line > #revealBtn { order: 4; flex: 1 1 calc(100% - 48px); }
  .top-bar.single-line > #clearBtn { order: 5; flex: 0 0 48px; }
}

.link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: clamp(13px, 1.1vw, 16px);
}

.link-label {
  font-weight: 600;
  font-size: clamp(13px, 1.1vw, 16px);
}

.icon-stack {
  display: inline-flex;
  gap: 6px;
}

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

.card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

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

.link-list a {
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.link-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

ol.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.layout-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 960px) {
  .layout-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.grid-two {
  display: grid;
  gap: 10px;
}

@media (min-width: 900px) {
  .grid-two.two-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
}

.field label {
  font-size: 14px;
  color: var(--muted);
}

input,
textarea,
button {
  font-family: var(--font);
}

input,
textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 12px;
  border-radius: 12px;
  font-size: 16px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 183, 5, 0.18);
}

button {
  background: var(--accent);
  color: #0b0d18;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 30px rgba(242, 183, 5, 0.25);
  font-size: 16px;
  text-align: center;
  width: 100%;
}

button:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
}

.filter-btn.active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: rgba(242, 183, 5, 0.08);
  color: var(--accent);
}

@media (max-width: 480px) {
  .filter-btn {
    font-size: 13px;
    padding: 8px 12px;
  }
  #questionList {
    margin-top: 8px;
  }
}

button.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 30px rgba(228, 87, 46, 0.25);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  gap: 8px;
}

.pill.status-active {
  background: rgba(47, 191, 113, 0.12);
  border-color: rgba(47, 191, 113, 0.5);
  color: #8cf2b7;
}

.pill.status-played {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #c9d1e9;
}

.pill.status-deleted {
  background: rgba(228, 87, 46, 0.12);
  border-color: rgba(228, 87, 46, 0.5);
  color: #ff9b7f;
}

.grid-two {
  display: grid;
  gap: 10px;
}

@media (min-width: 640px) {
  .grid-two {
    grid-template-columns: repeat(2, 1fr);
  }
}

.list {
  display: grid;
  gap: 12px;
}

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

.question-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  min-height: 100%;
}

.question-card small {
  color: var(--muted);
}

.question-card .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.question-card .body {
  white-space: pre-wrap;
  margin: 6px 0;
}

.monospace {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.display-layout {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  width: 100vw;
  overflow: hidden;
}

.display-card {
  max-width: 960px;
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 32px;
}

.display-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.display-logo {
  width: 120px;
  filter: invert(100%) brightness(200%) saturate(0%) contrast(120%);
}

.display-title {
  font-size: 32px;
  font-weight: 800;
  color: #ff3b3b;
}

.total-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.display-subtitle {
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

.display-total {
  text-align: center;
  font-size: 64px;
  font-weight: 800;
  margin-top: 4px;
}

.display-question {
  margin-top: 18px;
  font-size: 24px;
  line-height: 1.4;
  text-align: center;
}

.display-author {
  margin-top: 12px;
  color: var(--accent);
  font-weight: 700;
}

.display-answer {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(242, 183, 5, 0.6);
  background: rgba(242, 183, 5, 0.08);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.answer-appear {
  animation: firework 1.2s ease forwards;
}

.muted {
  color: var(--muted);
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--success);
  padding: 10px 12px;
  border-radius: 14px;
  border: none;
  color: #f7fff9;
  font-size: 13px;
  display: none;
  box-shadow: 0 12px 36px rgba(47, 191, 113, 0.35);
  font-weight: 700;
  text-align: center;
}

.toast.show {
  display: block;
}

.logo {
  width: 120px;
  height: auto;
  filter: brightness(0) saturate(100%) invert(100%) contrast(105%);
  display: block;
  margin: 0 auto 12px;
}

.image-preview {
  margin-top: 6px;
  display: inline-block;
  max-width: 100%;
  width: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.thumb {
  max-width: 160px;
  cursor: pointer;
}

.idle-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.question-mark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 28px;
  position: relative;
  animation: pulse 1.2s infinite ease-in-out;
}

.question-mark.large {
  width: 120px;
  height: 120px;
  font-size: 42px;
  border-width: 3px;
  margin-bottom: 30px;
}

.question-mark::after {
  content: '?';
  font-weight: 800;
}

.idle-text {
  color: var(--muted);
}

.randomizer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-direction: column;
  z-index: 999;
}

.randomizer-spinner {
  width: 72px;
  height: 72px;
  border: 6px solid rgba(242, 183, 5, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.countdown {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
}

.fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}

.fullscreen-btn svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.icon-btn {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  max-width: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0 !important;
  box-shadow: none;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
}

.icon-btn:hover {
  border-color: var(--accent);
}

.icon-btn.danger svg {
  fill: var(--danger);
}

.answer-container {
  width: 100%;
  max-width: 840px;
  padding: 0 12px;
}

.content-container {
  width: 100%;
  max-width: 840px;
  padding: 0 12px;
}

.firework-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.firework-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: burst 1s ease-out forwards;
}

@keyframes burst {
  from {
    transform: translate(0, 0) scale(0.6);
    opacity: 1;
  }
  to {
    transform: translate(var(--dx), var(--dy)) scale(1);
    opacity: 0;
  }
}

@keyframes firework {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  40% {
    opacity: 1;
    transform: translateY(-6px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popGlow {
  0% {
    opacity: 0;
    transform: scale(0.92);
    filter: drop-shadow(0 0 0 rgba(242, 183, 5, 0.25));
  }
  60% {
    opacity: 1;
    transform: scale(1.02);
    filter: drop-shadow(0 0 16px rgba(242, 183, 5, 0.35));
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(242, 183, 5, 0.2));
  }
}

.upload-area {
  display: block;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.upload-area:hover {
  border-color: var(--accent);
  background: rgba(242, 183, 5, 0.08);
}

.upload-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  padding-left: 40px;
}

.upload-sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  padding-left: 40px;
}

.file-input {
  opacity: 0;
  width: 1px;
  height: 1px;
  position: absolute;
  pointer-events: none;
}

.upload-filename {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-size: 14px;
  word-break: break-all;
  padding-left: 40px;
}

.upload-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  background: rgba(242, 183, 5, 0.15);
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.upload-icon svg {
  width: 14px;
  height: 14px;
  fill: var(--accent);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 12px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-image {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
