:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.debt-clock-body {
  margin: 0;
  min-width: 320px;
  color: #edf6f4;
  background-color: #273033;
  background-image: linear-gradient(rgba(7, 24, 28, 0.2), rgba(7, 24, 28, 0.2)), url('/usdebt-background.avif');
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

.debt-clock-app { width: min(1500px, 100%); margin: 0 auto; padding: 16px; }

.clock-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 2px solid #8d9d98;
  border-radius: 6px;
  background: transparent;
  box-shadow: 0 4px 0 #04090a;
}

.clock-brand, .clock-return { color: #ffffff; text-decoration: none; font-weight: 700; }
.clock-brand, .clock-return, .clock-title, .clock-hero { text-shadow: 0 1px 2px #000000; }
.clock-brand { display: inline-flex; align-items: center; gap: 8px; width: fit-content; }
.clock-brand span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; background: #ef1e4f; color: #fff; }
.clock-return { justify-self: end; color: #c2e7e0; }
.clock-return:hover { color: #ffffff; text-decoration: underline; }
.clock-title { text-align: center; }
.clock-title p, .clock-live, .section-heading p, .clock-updated { margin: 0; color: #b7cdc9; font-size: 13px; }
.clock-title h1 { margin: 2px 0 0; color: #f8d65f; font-size: 26px; line-height: 1; }

.clock-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-top: 16px;
  padding: 18px;
  border: 2px solid #607a77;
  border-radius: 6px;
  background: transparent;
}
.clock-live { color: #f6d559; font-weight: 700; }
.clock-live i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; background: #36da87; box-shadow: 0 0 0 3px rgba(54, 218, 135, 0.18); }
.clock-hero h2 { margin: 7px 0 0; font-size: 30px; }
.clock-updated { text-align: right; }
.clock-ad { min-height: 0; margin: 10px 0; overflow: hidden; border-radius: 5px; background: rgba(255, 255, 255, .15); }

.clock-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.clock-section { min-width: 0; padding: 12px; border: 2px solid rgba(96, 122, 119, 0.84); border-radius: 6px; background: transparent; box-shadow: 0 3px 0 rgba(4, 9, 10, 0.72); }
.clock-primary { border-color: #eb2938; background: transparent; box-shadow: 0 3px 0 rgba(67, 4, 10, 0.8), 0 0 18px rgba(235, 41, 56, 0.18); }
.section-heading { display: flex; justify-content: center; align-items: baseline; gap: 12px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #42605d; text-align: center; }
.section-heading h2 { margin: 0; color: #f6d559; font-size: 18px; }
.clock-primary .section-heading { padding: 6px 8px; border: 1px solid #ef3140; border-radius: 5px; background: rgba(170, 18, 30, 0.88); }
.clock-primary .section-heading h2, .clock-primary .section-heading p { color: #ffffff; }
.section-heading p { text-align: right; }

.clock-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.clock-card { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 76px; padding: 10px; border: 2px solid #6c7d78; border-radius: 6px; background: #e8eeea; color: #182524; text-align: center; box-shadow: inset 0 0 0 2px #ffffff, 0 2px 0 #031012; }
.clock-card h3 { display: block; overflow: hidden; margin: 0; font-size: 12px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.clock-value { display: block; align-self: center; width: 100%; overflow: visible; margin: 2px 0 3px; color: #0a3029; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; text-align: center; text-overflow: clip; transform-origin: center; white-space: nowrap; will-change: transform; }
.clock-card small { display: block; overflow: hidden; color: #566765; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.tone-red { border-color: #e22b31; }.tone-red .clock-value { color: #ef1828; font-weight: 800; }
.tone-green { border-color: #438f61; }.tone-green .clock-value { color: #147044; }
.tone-blue { border-color: #4e87b5; }.tone-blue .clock-value { color: #176395; }
.tone-amber { border-color: #b88a28; }.tone-amber .clock-value { color: #8c5b05; }
.tone-silver { border-color: #7c8b90; }.tone-silver .clock-value { color: #4d6268; }
.tone-military { border-color: #7f2632; background: rgba(255, 246, 230, 0.96); }
.clock-primary .clock-card:first-child { grid-column: span 2; border-width: 3px; border-color: #ef1828; background: rgba(255, 249, 249, 0.96); box-shadow: inset 0 0 0 2px #ffffff, 0 3px 0 #5e060d; }
.clock-primary .clock-card:first-child h3 { color: #9c0c18; font-size: 14px; font-weight: 800; }
.clock-primary .clock-card:first-child .clock-value { color: #ef1828; font-size: 29px; font-weight: 800; }
.clock-primary .clock-card:nth-child(6) { grid-column: span 2; }
.military-card h3 { color: #79222b; font-size: 11px; }
.military-stats { display: grid; gap: 5px; margin-top: 5px; }
.military-stat { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.military-stat span { color: #5c4a41; font-size: 10px; font-weight: 700; line-height: 1.1; text-align: center; white-space: nowrap; }
.military-stat .clock-value { margin: 0; color: #a4202d; font-size: 14px; font-weight: 800; text-align: center; }

.debt-ratio { margin-top: 9px; padding: 5px; border: 2px solid #bd2530; border-radius: 5px; background: rgba(255, 255, 255, 0.78); }
.debt-ratio h3 { margin: 0 0 4px; color: #b51a27; font-size: 11px; text-align: center; }
.debt-ratio-values { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.debt-ratio-values p { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px; margin: 0; }
.debt-ratio-values span { padding: 4px 3px; border-radius: 3px; background: #545454; color: #ffffff; font-size: 11px; font-weight: 700; text-align: center; }
.debt-ratio-values strong { padding: 3px; border: 1px solid #929292; border-radius: 3px; background: #ffffff; color: #ef1828; font-size: 18px; line-height: 1; text-align: center; }

.clock-footer { margin: 14px 0 5px; padding: 14px; border: 1px solid #49615e; border-radius: 6px; background: transparent; color: #213536; font-size: 12px; line-height: 1.45; }
.clock-footer p { margin: 0; }.clock-footer p + p { margin-top: 7px; }.clock-footer p:first-child { color: #f6d559; font-weight: 700; }

.usdebt-article { max-width: 980px; margin: 22px auto 8px; padding: clamp(18px, 3vw, 34px); border: 2px solid rgba(96, 122, 119, .86); border-radius: 7px; background: rgba(248, 250, 245, .94); box-shadow: 0 3px 0 rgba(4, 9, 10, .72); color: #1c2b2b; font-size: 16px; line-height: 1.72; }.usdebt-article h2 { margin: 14px 0 16px; color: #8d101d; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; }.usdebt-article p { margin: 0; }.usdebt-article p + p { margin-top: 18px; }.usdebt-article .usdebt-source-note { padding: 11px 14px; border-left: 4px solid #b71c2b; background: #f4e8e8; color: #4b3737; font-size: 13px; line-height: 1.5; }

@media (max-width: 1100px) {
  .clock-board { grid-template-columns: 1fr; }
  .clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock-value { font-size: 19px; }
}

@media (min-width: 720px) {
  .clock-primary .clock-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .clock-primary .clock-card h3 { font-size: 10px; }
  .clock-primary .clock-card:first-child h3 { font-size: 14px; }
  .clock-primary .clock-card:nth-child(4) .clock-value, .clock-primary .clock-card:nth-child(5) .clock-value, .clock-primary .clock-card:nth-child(6) .clock-value { font-size: 15px; }
  .clock-primary .clock-card:nth-child(6) { grid-column: span 2; }
  #poblacion { display: flex; flex-direction: column; }
  #poblacion .clock-grid { flex: 1; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  #poblacion .clock-card:nth-child(-n + 3) { grid-column: span 4; }
  #poblacion .clock-card:nth-child(n + 4) { grid-column: span 3; }
}

#poblacion .section-heading h2, #poblacion .section-heading p { color: #243938; font-weight: 800; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55); }
#poblacion .tone-blue .clock-value { color: #164d74; }
#poblacion .tone-green .clock-value { color: #0e6943; }

@media (max-width: 620px) {
  .debt-clock-app { padding: 8px; }
  .clock-topbar { grid-template-columns: 1fr auto; padding: 10px; }
  .clock-title { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .clock-title h1 { font-size: 22px; }
  .clock-hero { align-items: start; flex-direction: column; padding: 14px; }
  .clock-hero h2 { font-size: 25px; }.clock-updated { text-align: left; }
  .usdebt-article { margin-top: 16px; padding: 18px; font-size: 15px; line-height: 1.65; }.usdebt-article h2 { font-size: 25px; }
  .clock-card { min-height: 97px; padding: 8px; }.clock-card h3 { font-size: 11px; }.clock-value { font-size: 15px; }
  .clock-primary .clock-card:first-child .clock-value { font-size: 19px; }
  .section-heading { align-items: center; flex-direction: column; gap: 3px; }.section-heading p { text-align: center; }
  .debt-ratio-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .debt-ratio-values strong { font-size: 16px; }
}

@media (max-width: 380px) {
  .clock-grid { grid-template-columns: 1fr; }
  .clock-card { min-height: 82px; }.clock-value { font-size: 20px; }
}
