/* Possiber shared components. Import tokens.css first. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-headline);
  font-weight: 700;
  letter-spacing: var(--track-headline);
  color: var(--text-high-contrast);
  margin: 0 0 var(--space-2);
  line-height: 1.05;
}
h1 {
  font-size: 64px;
}
h2 {
  font-size: 48px;
}
h3 {
  font-size: 32px;
}
h4 {
  font-size: 24px;
}

.mono,
.label,
.timer {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: var(--track-mono);
  font-size: 14px;
  text-transform: uppercase;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Container & Layout --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-3) var(--space-6);
}
@media (max-width: 720px) {
  .container {
    padding: var(--space-4) var(--space-2) var(--space-5);
  }
}
.page-header {
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.page-header h3 {
  margin: 0;
}
.page-section {
  margin-top: var(--space-5);
  margin-bottom: var(--space-5);
}
/* --- Card --- */
.card {
  background: var(--surface-container);
  color: var(--on-surface);
  border: var(--border-width) solid var(--border-primary);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  padding: 10px 18px;
  border: var(--border-width) solid var(--border-primary);
  border-radius: var(--radius);
  background: var(--surface-container-high);
  color: var(--on-surface);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  user-select: none;
}
.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn:active,
.btn.is-pressed {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-color: var(--border-primary);
}
.btn-cyan {
  background: var(--cyan);
  color: #0a0a0a;
  border-color: var(--border-primary);
}
.btn-navy {
  background: var(--navy);
  color: #f5f5f5;
  border-color: var(--border-primary);
}
.btn-secondary {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
.btn-ghost {
  background: transparent;
  box-shadow: none;
}
.btn-ghost:active {
  transform: none;
}

/* --- Input --- */
.input,
.textarea,
.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  border: var(--border-width) solid var(--border-primary);
  border-radius: var(--radius);
  outline: none;
}
.input:focus,
.textarea:focus,
.select:focus {
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--border-primary);
}

/* --- Checkbox --- */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius);
  background: var(--surface-container-lowest);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 120ms, border-color 120ms;
}
input[type="checkbox"]:checked {
  background: var(--primary-container);
  border-color: var(--primary-container);
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 5px;
  height: 10px;
  border: solid var(--on-primary-container);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Radio --- */
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-primary);
  border-radius: 50%;
  background: var(--surface-container-lowest);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 120ms;
}
input[type="radio"]:checked {
  border-color: var(--primary-container);
}
input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-container);
}
input[type="radio"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.textarea {
  min-height: 96px;
  resize: vertical;
}

/* --- Chip / badge --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  padding: 4px 10px;
  border: var(--border-width) solid var(--border-primary);
  border-radius: var(--radius);
  background: var(--surface-container-low);
  color: var(--on-surface);
}
.chip-pro {
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.streak-chip {
  background: transparent;
  color: var(--amber);
  border-color: var(--amber);
}

/* --- Progress bar --- */
.progress {
  width: 100%;
  height: 10px;
  background: var(--surface-container-lowest);
  border: var(--border-width) solid var(--border-primary);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--primary-container);
}

/* --- Layout utility --- */
.row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.spacer {
  flex: 1 1 auto;
}
.grid {
  display: grid;
  gap: var(--space-2);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 720px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal {
  max-width: 480px;
  width: calc(100% - 32px);
  background: var(--surface-container);
  border: var(--border-width) solid var(--border-primary);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--border-primary);
  padding: var(--space-3);
}

/* --- Tour Tooltip --- */
.tt-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}
.tt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}
.tt-highlight {
  position: absolute;
  border-radius: var(--radius);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  display: none;
}
.tt-box {
  position: absolute;
  background: var(--surface-container);
  border: var(--border-width) solid var(--border-primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  max-width: 260px;
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--border-primary);
  pointer-events: auto;
}
.tt-step {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.tt-msg {
  font-size: 14px;
  line-height: 1.4;
  color: var(--on-surface);
  margin-bottom: 12px;
}
.tt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.tt-skip {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
}
.tt-skip:hover {
  color: var(--on-surface);
}
.tt-next {
  font-size: 13px;
  padding: 7px 14px;
}
