:root {
  --yellow: #ffe74a;
  --yellow-soft: #fff4ad;
  --black: #121212;
  --white: #ffffff;
  --gray: #efefef;
  --ink-soft: #2a2a2a;
  --danger: #ff3b30;
  --ok: #16a34a;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--black);
  background:
    linear-gradient(135deg, rgba(255, 231, 74, 0.28), rgba(255, 255, 255, 0.8)),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.02) 0, rgba(0, 0, 0, 0.02) 2px, transparent 2px, transparent 10px);
  font-family: "Consolas", "Courier New", monospace;
  line-height: 1.5;
}

.page {
  width: min(1100px, 92vw);
  margin: 28px auto 44px;
  display: grid;
  gap: 18px;
}

.brutal-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
  border: 3px solid var(--black);
  box-shadow: 8px 8px 0 var(--black), 0 10px 24px rgba(18, 18, 18, 0.08);
  padding: 16px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.hero-title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-sub {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

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

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.quiz-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.quiz-progress {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.quiz-progress p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.progress-track {
  border: 2px solid var(--black);
  background: #fff;
  height: 12px;
  width: 100%;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffd500, #ffec7a);
  transition: width 0.25s var(--ease);
}

.question-card {
  margin: 0;
  border: 2px solid var(--black);
  background: #fffdf1;
  padding: 10px;
}

.question-card legend {
  font-weight: 700;
  padding: 0 6px;
}

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

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #2f2f2f;
  background: #fff;
  padding: 8px;
  cursor: pointer;
}

.option-item:has(input:checked) {
  background: #ffe877;
  box-shadow: inset 0 0 0 2px #121212;
}

.option-item:hover {
  background: #fff8d6;
}

.option-item input {
  margin-top: 2px;
}

.quiz-actions {
  margin-top: 12px;
}

.quiz-actions .btn {
  width: 100%;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  border: 3px solid var(--black);
  border-radius: 0;
  padding: 10px;
  outline: none;
  background: var(--gray);
  transition: background-color 0.25s var(--ease), transform 0.25s var(--ease);
}

input:focus,
textarea:focus {
  background: #fffef3;
  transform: translateY(-1px);
}

textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
}

.btn {
  border: 3px solid var(--black);
  background: var(--yellow);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(18, 18, 18, 0.95);
  filter: saturate(1.05);
}

.btn:active {
  transform: translate(1px, 1px);
}

.primary {
  background: var(--black);
  color: var(--white);
}

.primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.hidden {
  display: none !important;
}

.loading-text {
  margin: 10px 0 0;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
}

.loading-text::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--black);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes blink {
  to {
    opacity: 0.35;
  }
}

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

.fortune-card {
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, #fffef6 0%, #ffffff 100%);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
}

.card-head p {
  margin: 0;
  font-weight: 700;
  color: var(--ink-soft);
}

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

.metric {
  border: 2px solid var(--black);
  padding: 8px;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow-soft) 100%);
  transform: translateY(10px);
  opacity: 0;
  animation: riseIn 0.55s var(--ease) forwards;
}

.metric:nth-child(2) {
  animation-delay: 0.05s;
}

.metric:nth-child(3) {
  animation-delay: 0.1s;
}

.metric p {
  margin: 0;
}

.metric .stars {
  margin-top: 6px;
  font-weight: 700;
}

.block h3 {
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

.block p,
.block ul {
  margin: 0;
}

.block ul {
  padding-left: 20px;
}

.highlight {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f1f1f;
}

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

.brand-mark {
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
}

.actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-message {
  margin: 0;
  font-size: 0.9rem;
  min-height: 1.4em;
}

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

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

.tip {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

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

.feed-item {
  border: 2px solid var(--black);
  padding: 8px;
  background: #fffbe5;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.feed-item:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 rgba(18, 18, 18, 0.9);
}

.feed-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.like-btn {
  border: 2px solid var(--black);
  background: var(--white);
  cursor: pointer;
  padding: 3px 8px;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}

.like-btn:hover {
  transform: translateY(-1px);
  background: #fff6c8;
}

.success {
  color: var(--ok);
}

.error {
  color: var(--danger);
}

.result-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.result-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 1000;
}

.modal-card {
  width: min(680px, 94vw);
  max-height: 90vh;
  overflow: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.modal-head h3 {
  margin: 0;
}

#signImage {
  margin-top: 10px;
  width: 100%;
  border: 2px solid var(--black);
  display: block;
}

.modal-actions {
  margin-top: 10px;
}

@keyframes riseIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 840px) {
  .input-row,
  .split,
  .community-grid {
    grid-template-columns: 1fr;
  }

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

  .btn {
    width: 100%;
    min-height: 44px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-card {
    width: 96vw;
  }

  .question-card {
    padding: 12px;
  }

  .option-item {
    padding: 10px;
  }

  .quiz-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), #fff 45%);
    padding-top: 10px;
  }

  .brutal-card {
    box-shadow: 4px 4px 0 var(--black), 0 6px 14px rgba(18, 18, 18, 0.08);
  }
}
