/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:       #e8650a;
  --orange-hover: #cf570a;
  --green:        #1a7a3f;
  --text:         #222426;
  --text-muted:   #555a60;
  --error:        #cc2a2a;
  --radius:       10px;
  --font-display: 'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

html, body { height: 100%; }

body {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background-image: url('trees.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* ── Layout ───────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ── Header ───────────────────────────────────────────────────── */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title {
  font-size: clamp(2.6rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--orange);
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  width: 100%;
  background: rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--orange);
  border-radius: 16px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

/* ── Fields ───────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.field-group {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.input {
  width: 100%;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  -moz-appearance: textfield;
}

.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button { -webkit-appearance: none; }

.input::placeholder { color: var(--text-muted); opacity: 0.7; }

.input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,101,10,0.18);
}

.input.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(204,42,42,0.15);
}

/* Affix wrapper */
.input-affix { position: relative; }

.input-affix .input { padding-right: 38px; }

.affix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Two-column row */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Error text */
.error-msg {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 5px;
  min-height: 1.1em;
  font-family: var(--font-mono);
}

/* ── Main Button ──────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 4px 18px rgba(232,101,10,0.30);
}

.btn:hover {
  background: var(--orange-hover);
  box-shadow: 0 4px 24px rgba(232,101,10,0.45);
}

.btn:active { transform: scale(0.98); }

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Result ───────────────────────────────────────────────────── */
.result {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: rgba(46, 158, 91, 0.08);
  border: 1px solid rgba(46, 158, 91, 0.35);
  border-radius: var(--radius);
  padding: 14px 16px;
  animation: fadeIn 0.3s ease;
}

.result.visible { display: flex; }

.result-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  opacity: 0.8;
  margin-bottom: 3px;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.03em;
}

/* ── Result action buttons ────────────────────────────────────── */
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  width: 100%;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--green);
  opacity: 0.75;
  padding: 5px;
  border-radius: 6px;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.copy-btn:hover {
  opacity: 1;
  background: rgba(46, 158, 91, 0.12);
}

.copy-btn svg { width: 18px; height: 18px; }

/* ── Hint ─────────────────────────────────────────────────────── */
.hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid rgba(0,0,0,0.1);
  padding-top: 16px;
}

.hint code {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
}

/* ── Word value result ────────────────────────────────────────── */
.word-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.word-sum {
  font-size: 1.6rem !important;
  font-weight: 600;
}

.letter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.letter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  background: rgba(46, 158, 91, 0.12);
  border: 1px solid rgba(46, 158, 91, 0.3);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--green);
}

.letter-char {
  background: rgba(46, 158, 91, 0.06);
  font-weight: 600;
  color: var(--text);
}

/* ── Mode toggling ────────────────────────────────────────────── */
#bearingSection {
  display: none;
  flex-direction: column;
  gap: 0;
}

#bearingSection.visible {
  display: flex;
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Consent Banner ───────────────────────────────────────────── */
#consentBanner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 560px;
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--orange);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#consentBanner.consent-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(16px);
}

.consent-text {
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
}

.consent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.consent-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.consent-btn:active { transform: scale(0.97); }

.consent-btn--accept {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 10px rgba(232,101,10,0.25);
}

.consent-btn--accept:hover { background: var(--orange-hover); }

.consent-btn--decline {
  background: rgba(0,0,0,0.07);
  color: var(--text-muted);
}

.consent-btn--decline:hover { background: rgba(0,0,0,0.12); }

@media (max-width: 480px) {
  #consentBanner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .consent-actions { width: 100%; }
  .consent-btn { flex: 1; text-align: center; }
}
@media (max-width: 400px) {
  .card { padding: 20px 16px; }
  .result-value { font-size: 0.85rem; }
}
