/* The loss block is shown and hidden with the hidden attribute; its own
   display: flex would otherwise keep it on screen. */
[hidden] { display: none !important; }

/* Earnings calculator, all four locales (/calculator/, /ru/calculator/, ...).
   Moved out of the pages' <style> blocks and style="" attributes (task #7014). */

* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: rgba(234,88,12,0.12); }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1C1917;
  min-height: 100vh;
  background: linear-gradient(180deg, #FFF7ED 0%, #FAFAF9 50%, #FFFFFF 100%);
}
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: none; background: transparent; }

/* Nav */
.nav { padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; max-width: 960px; margin: 0 auto; gap: 12px; }
.nav-logo { font-size: 22px; font-weight: 800; color: #EA580C; letter-spacing: -0.5px; text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.lang-switch { font-size: 13px; color: #78716C; font-weight: 600; letter-spacing: 0.5px; text-decoration: none; }
.lang-switch:hover { color: #C2410C; }
.nav-cta {
  background: #C2410C; color: #fff; padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; text-decoration: none; transition: background 0.2s;
}
.nav-cta:hover { background: #9A3412; }

.container { max-width: 720px; margin: 0 auto; padding: 20px 20px 60px; }

/* Header */
.header { text-align: center; margin-bottom: 36px; }
.header h1 { font-size: 36px; font-weight: 800; color: #1C1917; letter-spacing: -1px; line-height: 1.2; }
.header p { font-size: 16px; color: #78716C; margin-top: 10px; max-width: 460px; margin-left: auto; margin-right: auto; }

/* Card */
.card {
  background: #FFFFFF; border-radius: 12px; padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

/* Slider */
.slider { margin-bottom: 28px; }
.slider.slider-last { margin-bottom: 0; }
.slider-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.slider-label { font-size: 14px; font-weight: 600; color: #44403c; }
.slider-value { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 800; color: #1C1917; }
.slider-track { position: relative; height: 6px; background: #E7E5E4; border-radius: 3px; }
.slider-fill { position: absolute; left: 0; top: 0; height: 6px; border-radius: 3px; transition: width 0.1s; }
.slider-fill.tone-orange { background: #EA580C; }
.slider-fill.tone-purple { background: #7C3AED; }
.slider-fill.tone-green { background: #059669; }
.slider-fill.tone-red { background: #DC2626; }
.slider-input {
  position: absolute; top: -8px; left: 0; width: 100%; height: 22px;
  opacity: 0; cursor: pointer; margin: 0;
}
.slider-thumb {
  position: absolute; top: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  pointer-events: none; transition: left 0.1s; border-width: 3px; border-style: solid;
}
/* The native input is invisible (opacity 0), so keyboard focus is drawn on the thumb. */
.slider-input:focus-visible + .slider-thumb { outline: 2px solid #1C1917; outline-offset: 2px; }
.slider-thumb.tone-orange { border-color: #EA580C; }
.slider-thumb.tone-purple { border-color: #7C3AED; }
.slider-thumb.tone-green { border-color: #059669; }
.slider-thumb.tone-red { border-color: #DC2626; }
.slider-range { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: #78716C; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: #FFFFFF; border-radius: 12px; padding: 20px;
  border: 1px solid #E7E5E4; position: relative; overflow: hidden;
}
.stat-icon { position: absolute; top: 12px; right: 14px; font-size: 28px; opacity: 0.15; }
.stat-label { font-size: 12px; font-weight: 600; color: #78716C; margin-bottom: 6px; }
.stat-value { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.stat-value.is-dark { color: #1C1917; }
.stat-value.is-orange { color: #EA580C; }
.stat-value.is-green { color: #059669; }
.stat-sub { font-size: 12px; color: #78716C; margin-top: 4px; }

/* Loss block */
.loss-block {
  background: linear-gradient(135deg, #FEF2F2, #FFF1F2); border-radius: 12px;
  padding: 22px; margin-bottom: 20px; border: 1px solid #FECACA;
  display: flex; align-items: center; gap: 18px;
}
.loss-icon {
  width: 56px; height: 56px; border-radius: 12px; background: #FEE2E2;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
}
.loss-title { font-size: 14px; font-weight: 700; color: #991B1B; margin-bottom: 4px; }
.loss-sub { font-size: 13px; color: #B91C1C; line-height: 1.5; }

/* Chart */
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.chart-title { font-size: 15px; font-weight: 700; color: #1C1917; }
.chart-legend { display: flex; gap: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #78716C; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.chart-legend-dot.is-earned { background: #EA580C; }
.chart-legend-dot.is-lost { background: rgba(220,38,38,0.19); }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 0 4px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-col-bars { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 96px; }
.chart-bar-lost { width: 80%; border-radius: 4px 4px 0 0; background: rgba(220,38,38,0.19); }
.chart-bar-earned { width: 80%; background: linear-gradient(180deg, #EA580C, #C2410C); }
.chart-month { font-size: 9px; color: #78716C; font-weight: 500; }

/* Breakdown */
.breakdown-title { font-size: 15px; font-weight: 700; color: #1C1917; margin-bottom: 16px; }
.breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
}
.breakdown-row + .breakdown-row { border-top: 1px solid #F5F5F4; }
.breakdown-label { font-size: 13px; color: #78716C; }
.breakdown-value { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 700; color: #1C1917; }
.breakdown-value.danger { color: #DC2626; }
.breakdown-value.success { color: #047857; }

/* CTA */
.cta {
  background: linear-gradient(135deg, #1C1917, #292524); border-radius: 12px;
  padding: 32px; text-align: center; margin-bottom: 24px;
}
.cta-emoji { font-size: 28px; margin-bottom: 12px; }
.cta h3 { font-size: 20px; font-weight: 800; color: #FFFFFF; margin-bottom: 8px; }
.cta p { font-size: 14px; color: #A8A29E; line-height: 1.7; max-width: 400px; margin: 0 auto 20px; }
.cta-savings { font-size: 22px; font-weight: 800; color: #059669; margin-bottom: 20px; }
.cta-btn {
  display: inline-block; background: #C2410C; color: #fff;
  padding: 14px 32px; border-radius: 12px; font-size: 15px; font-weight: 700;
  text-decoration: none; box-shadow: 0 4px 14px rgba(234,88,12,0.35);
  transition: all 0.2s;
}
.cta-btn:hover { background: #9A3412; transform: translateY(-1px); }
.cta-fine { font-size: 12px; color: #A8A29E; margin-top: 12px; }

/* Mobile */
@media (max-width: 640px) {
  .header h1 { font-size: 28px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 24px; }
  .slider-value { font-size: 18px; }
  .loss-block { flex-direction: column; text-align: center; gap: 12px; }
  .cta { padding: 24px 20px; }
  .cta h3 { font-size: 18px; }
  .slider-thumb { width: 28px; height: 28px; top: -11px; }
  .slider-input { height: 28px; top: -11px; }
  .chart-month { font-size: 10px; }
  .breakdown-label { font-size: 12px; }
}

/* Russian and Turkish money runs longer ("12 500 ₽"): smaller figures and
   wider text columns keep the cards on one line. */
:lang(ru) .header p, :lang(tr) .header p { max-width: 480px; }
:lang(ru) .cta p, :lang(tr) .cta p { max-width: 440px; }
:lang(ru) .stat-value, :lang(tr) .stat-value { font-size: 26px; }
@media (max-width: 640px) {
  :lang(ru) .stat-value, :lang(tr) .stat-value { font-size: 22px; }
}
