/* Coin Flip — Tool Styles */
/* Inherits brand tokens from /assets/css/site.css */

/* ── Tool Layout ──────────────────────────────────────────────────────────── */

.tool-main {
  width: 100%;
  max-width: var(--tool-max);
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tool-header { text-align: center; }

.tool-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.tool-header p {
  margin-top: 0.3rem;
  color: var(--stone);
  font-size: 0.95rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Coin Section ─────────────────────────────────────────────────────────── */

.coin-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

/* ── Coin ─────────────────────────────────────────────────────────────────── */

.coin-scene {
  width: 140px;
  height: 140px;
}

.coin {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--bg);
  border: 4px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1), inset 0 2px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

.coin.coin--heads {
  background: var(--accent);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(55, 48, 163, 0.35), inset 0 2px 4px rgba(255,255,255,0.15);
}

.coin.coin--tails {
  background: var(--highlight);
  border-color: #9f1239;
  box-shadow: 0 6px 24px rgba(190, 18, 60, 0.35), inset 0 2px 4px rgba(255,255,255,0.15);
}

.coin-letter {
  font-size: 3rem;
  font-weight: 800;
  color: var(--stone);
  line-height: 1;
  user-select: none;
}

.coin--heads .coin-letter,
.coin--tails .coin-letter {
  color: #ffffff;
}

/* Flip animation — squish on X axis, face swaps at 0 width */

@keyframes coin-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@keyframes coin-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.coin--shrink { animation: coin-shrink 0.18s ease-in forwards; }
.coin--grow   { animation: coin-grow   0.22s ease-out forwards; }

/* ── Result Display ───────────────────────────────────────────────────────── */

.result-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-height: 3rem;
}

.result-text {
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.result-text--heads { color: var(--accent); }
.result-text--tails { color: var(--highlight); }

.result-sub {
  font-size: 0.85rem;
  color: var(--stone);
  font-weight: 600;
}

@keyframes result-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

.result-text--pop {
  animation: result-pop 0.3s ease-out both;
}

/* ── Primary Button ───────────────────────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  min-height: 52px;
  touch-action: manipulation;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(55, 48, 163, 0.3);
}

.btn-primary:hover        { background: var(--accent-hover); box-shadow: 0 3px 10px rgba(55, 48, 163, 0.35); }
.btn-primary:active       { transform: scale(0.98); }
.btn-primary:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn-primary:disabled     { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Stats Section ────────────────────────────────────────────────────────── */

.stats-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stats-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  gap: 0;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
}

.stat-heads .stat-value { color: var(--accent); }
.stat-tails .stat-value { color: var(--highlight); }

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--stone);
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── History Row ──────────────────────────────────────────────────────────── */

.history-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  min-height: 26px;
}

.history-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
}

.history-pill--heads { background: var(--accent); }
.history-pill--tails { background: var(--highlight); }

/* ── Action Row ───────────────────────────────────────────────────────────── */

.action-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-secondary:hover        { background: var(--bg); border-color: #c8c0b0; }
.btn-secondary:active       { background: #EDEDFF; }
.btn-secondary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Cross-link Banner ────────────────────────────────────────────────────── */

.crosslink-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--warm-bg);
  border-top: 1px solid var(--warm-border);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  color: var(--stone);
  flex-wrap: wrap;
  text-align: center;
}

.crosslink-banner a {
  color: var(--warm);
  font-weight: 700;
  text-decoration: none;
}

.crosslink-banner a:hover { text-decoration: underline; }

/* ── Toast ────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  white-space: nowrap;
  animation: toast-in 0.2s ease-out;
  pointer-events: none;
}

.toast--hide { animation: toast-out 0.25s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

/* ── Print ────────────────────────────────────────────────────────────────── */

@media print {
  .skip-link, .site-header, .ad-slot, .site-footer,
  .action-row, .crosslink-banner { display: none !important; }
  body { background: #fff; }
  .tool-main { padding: 0; max-width: 100%; }
}
