@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/CormorantGaramond-500.ttf") format("truetype");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/CormorantGaramond-600.ttf") format("truetype");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/CormorantGaramond-500italic.ttf") format("truetype");
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/Onest-400.ttf") format("truetype");
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/Onest-500.ttf") format("truetype");
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/Onest-600.ttf") format("truetype");
}

:root {
  --ink: #14110e;
  --text: #f3ecdf;
  --muted: #c4b59a;
  --gold: #d7bc8c;
  --ink-text: #1c140c;
  --seal: #8d3b42;
  --line: rgba(215, 188, 140, 0.18);
  --field-line: rgba(215, 188, 140, 0.45);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(90% 42% at 0% -8%, rgba(215, 188, 140, 0.16), transparent 58%),
    var(--ink);
  color: var(--text);
  font-family: Onest, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--gold); }

h1, .title, .screen-title {
  margin: 0;
  color: var(--text);
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 42px;
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
}

.brand {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lead, .description {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.35;
}

.sheet, .screen {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 22px 20px 96px;
}

.plate + .sheet { padding-top: 6px; }

.plate {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 148px;
  padding: 0 20px 16px;
  background:
    linear-gradient(to top, rgba(20, 17, 14, 0.94) 0%, rgba(20, 17, 14, 0.16) 62%),
    var(--ink) center / cover no-repeat;
}

.plate .brand { margin: 0; }

.plate.tarot-plate {
  background-image:
    linear-gradient(to top, rgba(20, 17, 14, 0.94) 0%, rgba(20, 17, 14, 0.2) 64%),
    url("tarot_images/witch_bg.jpg");
  background-size: cover;
  background-position: center 42%;
}

.plate.scheduler-plate {
  background-image:
    linear-gradient(to top, rgba(20, 17, 14, 0.94) 0%, rgba(20, 17, 14, 0.2) 64%),
    url("images/scheduler_bg.jpg");
  background-size: cover;
  background-position: center 30%;
}

.back-button, .back-btn, .text-btn {
  border: none;
  background: transparent;
  color: var(--gold);
  font: 500 14px/1 Onest, sans-serif;
  padding: 4px 0;
}

.back-btn {
  align-self: flex-start;
  width: fit-content;
  margin-bottom: 12px;
  text-align: left;
}

.home-back {
  display: block;
  width: fit-content;
  margin: 0 0 16px;
  align-self: flex-start;
}

.plate .back-button {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 8px;
  background: rgba(20, 17, 14, 0.45);
  color: var(--text);
}

.hidden { display: none !important; }

.row, .options .button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 9px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 500 15px/1.3 Onest, sans-serif;
  text-align: left;
}

.row {
  justify-content: flex-start;
  align-items: center;
  padding: 12px 0;
}

h1 + .row { margin-top: 18px; }

.row .mark {
  flex: none;
  width: 1.7em;
  font-size: 20px;
  line-height: 1;
  text-align: center;
}

.row .meta, .options .button .meta {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.row:hover, .options .button:hover { color: var(--gold); }

.options {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin-top: 8px;
}

.options .button.disabled {
  color: var(--muted);
  background: transparent;
  cursor: default;
}

.field, .form-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 16px;
}

.field > span, .form-group > label {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  margin: 0;
  padding: 8px 0 10px;
  border: none;
  border-bottom: 1px solid var(--field-line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 16px/1.4 Onest, sans-serif;
}

textarea { min-height: 64px; resize: none; }
select { cursor: pointer; }
::placeholder { color: #8d7f6c; }
input:disabled, textarea:disabled, select:disabled { opacity: 0.45; }

input[type="radio"], input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
  accent-color: var(--gold);
}

.radio-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  margin: 0;
}

.radio-group > div, .radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.radio-group label, .radio-option label {
  display: inline;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.form-group:has(> input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.form-group:has(> input[type="checkbox"]) > input { order: 0; }
.form-group:has(> input[type="checkbox"]) > label { order: 1; }

.form-group:has(> input[type="checkbox"]) > label {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--text);
  font-size: 15px;
}

.gold, .submit-btn, .add-btn, #confirm {
  width: 100%;
  height: 46px;
  margin-top: 18px;
  padding: 0 16px;
  border: none;
  border-radius: 2px;
  background: var(--gold);
  color: var(--ink-text);
  font: 600 15px/1 Onest, sans-serif;
}

.gold:hover, .submit-btn:hover:not(:disabled), .add-btn:hover, #confirm:hover {
  background: #e4cdab;
}

.submit-btn:disabled {
  background: #3a3228;
  color: #8a7b68;
  cursor: default;
}

.modal {
  display: none;
  position: fixed;
  z-index: 20;
  inset: 0;
  padding: 24px 16px;
  background: rgba(8, 7, 6, 0.72);
}

.modal-content {
  width: min(420px, 100%);
  margin: 12vh auto 0;
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #1c1814;
  color: var(--text);
}

.close {
  float: right;
  color: var(--gold);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.question-container, .footer { width: 100%; }

.deck {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  margin-top: 16px;
}

.card {
  width: 100px;
  height: 150px;
  border-radius: 8px;
  background: url("tarot_images/back.jpg") center / cover no-repeat;
  cursor: pointer;
}

.card.inactive { cursor: default; opacity: 0.55; }

.manual-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.manual-card select { flex: 1; min-width: 180px; width: auto; }

.action-type-group, .tab-container { display: none; }
.tab-container.active { display: block; }

.schedule-list { width: 100%; margin-top: 8px; }

.schedule-item {
  position: relative;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--line);
}

.schedule-item h3 {
  margin: 0 0 6px;
  padding-right: 150px;
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.schedule-item p { margin: 4px 0; color: var(--muted); font-size: 14px; }

.item-actions {
  position: absolute;
  top: 14px;
  right: 0;
  display: flex;
  gap: 6px;
}

.edit-btn, .delete-btn {
  width: auto;
  height: auto;
  margin: 0;
  padding: 6px 8px;
  border-radius: 2px;
  font: 500 12px/1 Onest, sans-serif;
}

.edit-btn {
  border: 1px solid var(--field-line);
  background: transparent;
  color: var(--gold);
}

.delete-btn {
  border: none;
  background: var(--seal);
  color: var(--text);
}

.empty-message, .error-message {
  padding: 28px 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 22px;
  text-align: center;
}

.error-message { color: #e7b4b4; }

.loading {
  display: flex;
  justify-content: center;
  padding: 28px 0;
}

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

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

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.screen.hidden { display: none !important; }

.quiz-title {
  margin: 8px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}

.progress-wrap { margin-top: 14px; }

.progress-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-family: Onest, sans-serif;
}

.progress-bar-track {
  height: 2px;
  background: rgba(215, 188, 140, 0.2);
}

.progress-bar-fill {
  height: 100%;
  background: var(--gold);
}

.question-block { margin-top: 28px; }

.question-text {
  margin: 0 0 8px;
  color: var(--text);
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.25;
}

.catalog-grid, .answers-list {
  display: flex;
  flex-direction: column;
}

.quiz-card {
  padding: 14px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.quiz-card-emoji { font-size: 18px; line-height: 1; }

.quiz-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.quiz-card-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.quiz-card-desc { margin-top: 4px; color: var(--muted); font-size: 14px; }
.quiz-card-meta { margin-top: 4px; color: #8d7f6c; font-size: 12px; }

.answer-btn {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 500 15px/1.4 Onest, sans-serif;
  text-align: left;
}

.answer-btn.selected {
  box-shadow: inset 2px 0 0 var(--gold);
  padding-left: 10px;
  color: var(--gold);
}

.answer-btn.color-choice {
  border-left-style: solid;
  border-left-width: 4px;
  padding-left: 12px;
}

input.answer-btn {
  display: block;
  border-bottom: 1px solid var(--field-line);
  background: transparent;
}

.quiz-footer { margin-top: auto; padding-top: 20px; }

.done-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.done-icon { font-size: 40px; }

.done-text {
  color: var(--text);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 26px;
  line-height: 1.35;
}

.tz-panel {
  display: none;
  position: fixed;
  z-index: 30;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #1c1814;
  color: var(--text);
  font: 15px/1.4 Onest, sans-serif;
}

.tz-panel select { margin: 10px 0; }
.tz-actions { display: flex; gap: 12px; align-items: center; }
.tz-panel .gold { width: auto; min-width: 140px; height: 42px; margin-top: 0; }
#ezo-timezone-error { margin-top: 8px; color: #e7b4b4; min-height: 1.2em; }

@media (max-width: 380px) {
  h1, .title, .screen-title { font-size: 34px; }
  .question-text { font-size: 24px; }
  .card { width: 84px; height: 126px; }
}

@media (prefers-reduced-motion: reduce) {
  .loading::after { animation: none; }
}
