.times-table-app,
.times-table-app * { box-sizing: border-box; }

.times-table-app {
  --tt-ink: #17372a;
  --tt-deep: #0b2117;
  --tt-panel: #123326;
  --tt-panel-2: #194332;
  --tt-cream: #fbf5e8;
  --tt-paper: #fffaf0;
  --tt-amber: #f5b841;
  --tt-amber-soft: #ffd57e;
  --tt-mint: #7fd7ae;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  color: #e9f0eb;
  background: var(--tt-deep);
  font-family: Inter, var(--body);
}

.times-table-app button,
.times-table-app input { font: inherit; }

.times-table-app button,
.times-table-app a { -webkit-tap-highlight-color: transparent; }

.tt-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, .6fr);
  align-items: end;
  gap: clamp(24px, 5vw, 72px);
  padding: clamp(28px, 5vw, 62px);
  background:
    radial-gradient(600px 300px at 100% 0, rgba(127, 215, 174, .15), transparent 65%),
    radial-gradient(rgba(245, 184, 65, .075) 1px, transparent 1.5px);
  background-size: auto, 20px 20px;
  border-bottom: 1px solid rgba(245, 184, 65, .23);
}

.tt-eyebrow {
  margin: 0 0 10px !important;
  color: var(--tt-mint) !important;
  text-transform: uppercase;
  letter-spacing: .17em;
  font-size: 10px !important;
  font-weight: 800;
}

.tt-intro h2 {
  max-width: 760px;
  margin: 0;
  color: #fff8e7 !important;
  font-size: clamp(30px, 5vw, 58px) !important;
  font-family: var(--display) !important;
  font-weight: 650 !important;
  line-height: 1.02 !important;
  letter-spacing: -.045em !important;
}

.tt-intro-copy > p:last-child {
  max-width: 720px;
  margin: 18px 0 0 !important;
  color: #b8cbbf !important;
  font-size: clamp(14px, 1.8vw, 18px) !important;
}

.tt-benefits { display: grid; gap: 10px; }
.tt-benefits span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  color: #aec3b6;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px;
}
.tt-benefits b { color: var(--tt-amber-soft); font-weight: 800; }

.tt-tabs {
  display: flex;
  gap: 8px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: #0e2b1f;
  border-bottom: 1px solid rgba(245, 184, 65, .2);
}

.tt-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 16px;
  color: #b8cbbf;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.tt-tabs button span { color: var(--tt-mint); font-size: 17px; line-height: 1; }
.tt-tabs button:hover { color: #fff8e7; border-color: rgba(127, 215, 174, .5); }
.tt-tabs button.is-active { color: var(--tt-ink); background: linear-gradient(145deg, var(--tt-amber-soft), var(--tt-amber)); border-color: var(--tt-amber); }
.tt-tabs button.is-active span { color: var(--tt-ink); }

.tt-panel[hidden] { display: none !important; }
.tt-custom-panel {
  display: grid;
  grid-template-columns: minmax(250px, .43fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 46px);
  padding: clamp(20px, 4vw, 48px);
  background: linear-gradient(135deg, #102d21, #153d2d);
}

.tt-controls { align-self: start; position: sticky; top: 18px; min-width: 0; }
#formWrapper {
  padding: clamp(18px, 3vw, 28px);
  background: rgba(7, 29, 20, .64);
  border: 1px solid rgba(127, 215, 174, .22);
  border-radius: 16px;
  box-shadow: 0 25px 55px -42px rgba(0, 0, 0, .9);
}
#formWrapper label { display: block; margin-bottom: 13px; color: #f7f1e5; font-size: 15px; font-weight: 750; line-height: 1.4; }
.tt-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#inputNumber {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  color: #fff8e7;
  background: #0a251a;
  border: 1px solid rgba(127, 215, 174, .38);
  border-radius: 10px;
  outline: none;
  font-size: 18px;
  font-weight: 750;
}
#inputNumber:focus { border-color: var(--tt-amber); box-shadow: 0 0 0 3px rgba(245, 184, 65, .13); }
#btnGenerate {
  min-height: 48px;
  padding: 0 17px;
  color: #2d2a17;
  background: linear-gradient(145deg, var(--tt-amber-soft), var(--tt-amber));
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
#btnGenerate:hover { filter: brightness(1.05); transform: translateY(-1px); }
#btnGenerate span { margin-left: 7px; }
.tt-message { margin: 10px 0 0 !important; color: #91aa9c !important; font-size: 11px !important; }
.tt-message.is-error { color: #ffb49e !important; }

.tt-downloads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 11px; }
.tt-downloads button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  color: #e8f0eb;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.tt-downloads button:hover { color: var(--tt-amber-soft); background: rgba(245, 184, 65, .08); border-color: rgba(245, 184, 65, .4); }
.tt-downloads button span { color: var(--tt-mint); font-size: 15px; }
.tt-downloads .is-image-download {
  color: #2f2a16 !important;
  -webkit-text-fill-color: #2f2a16 !important;
  background: linear-gradient(145deg, var(--tt-amber-soft), var(--tt-amber));
  border-color: #dfa82f;
  box-shadow: 0 12px 24px -18px rgba(245, 184, 65, .9);
}
.tt-downloads .is-image-download span { color: #2f2a16 !important; -webkit-text-fill-color: #2f2a16 !important; }
.tt-downloads .is-image-download:hover { color: #1d2e25 !important; -webkit-text-fill-color: #1d2e25 !important; background: linear-gradient(145deg, #ffe09a, #f8c253); border-color: var(--tt-amber); }
.tt-downloads #btnPrint > span { display: none; }
.tt-downloads #btnPrint::before,
.tt-chart-actions .tt-print-button::before {
  content: "";
  display: block;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9V2h12v7h1a3 3 0 0 1 3 3v6h-4v4H6v-4H2v-6a3 3 0 0 1 3-3h1Zm2-5v5h8V4H8Zm8 12H8v4h8v-4Zm3-5H5a1 1 0 0 0-1 1v4h2v-2h12v2h2v-4a1 1 0 0 0-1-1Zm-1 1.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9V2h12v7h1a3 3 0 0 1 3 3v6h-4v4H6v-4H2v-6a3 3 0 0 1 3-3h1Zm2-5v5h8V4H8Zm8 12H8v4h8v-4Zm3-5H5a1 1 0 0 0-1 1v4h2v-2h12v2h2v-4a1 1 0 0 0-1-1Zm-1 1.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tt-preview-shell { min-width: 0; padding: clamp(10px, 2vw, 18px); background: #081e15; border: 1px solid rgba(245, 184, 65, .2); border-radius: 18px; }
.tt-preview-label { display: flex; justify-content: space-between; align-items: center; padding: 1px 3px 12px; color: #d9e5de; text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 850; }
.tt-preview-label small { color: #7fd7ae; font-size: inherit; }

#containerTable {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 720px);
  min-height: min(1024px, 130vw);
  margin: 0 auto;
  overflow: hidden;
  padding: clamp(24px, 5vw, 54px);
  color: #213b30;
  background:
    linear-gradient(rgba(255, 250, 240, .92), rgba(255, 250, 240, .95)),
    url("mutiplication-table-sheet.png") center / cover;
  border: 1px solid #d8cba9;
  border-radius: 8px;
  box-shadow: 0 30px 60px -38px rgba(0, 0, 0, .85);
}
#containerTable::before { content: ""; position: absolute; inset: 14px; pointer-events: none; border: 1px solid rgba(23, 55, 42, .12); }
.tt-sheet-kicker { position: relative; margin: 0 0 7px !important; color: #a76d0d !important; text-align: center; text-transform: uppercase; letter-spacing: .21em; font-size: clamp(7px, 1vw, 10px) !important; font-weight: 850; }
#headingTable { position: relative; margin: 0 0 clamp(14px, 3vw, 27px); color: var(--tt-ink) !important; text-align: center; font-size: clamp(19px, 4vw, 35px) !important; font-weight: 750 !important; line-height: 1.14 !important; }
#tableResult { position: relative; width: 100%; border-collapse: collapse; table-layout: fixed; }
#tableResult td { padding: clamp(3px, .62vw, 7px) 8px; color: #294438; border-bottom: 1px solid rgba(23, 55, 42, .13); text-align: center; font-size: clamp(10px, 2vw, 18px); font-weight: 650; line-height: 1.25; }
#tableResult tr:nth-child(5n) td { border-bottom-color: rgba(183, 121, 18, .38); }
#tableResult td b { display: inline-block; min-width: 28%; color: #9d6710; font-weight: 850; }
#containerTable footer { position: relative; display: flex; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 16px; color: #6c7c73; border-top: 1px solid rgba(23, 55, 42, .16); text-transform: uppercase; letter-spacing: .1em; font-size: clamp(6px, 1vw, 9px); }
#containerTable footer b { color: var(--tt-ink); }

.tt-chart-panel { padding: clamp(24px, 4vw, 48px); background: linear-gradient(135deg, #102d21, #153d2d); }
.tt-section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr); align-items: end; gap: 28px; margin-bottom: 25px; }
.tt-section-heading h3 { margin: 0; color: #fff8e7 !important; font-family: var(--display) !important; font-size: clamp(24px, 4vw, 40px) !important; line-height: 1.08 !important; }
.tt-section-heading > p { margin: 0 !important; color: #a9c0b2 !important; font-size: 13px !important; }
.tt-chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.tt-chart-card { min-width: 0; overflow: hidden; background: var(--tt-cream); border: 1px solid rgba(245, 184, 65, .32); border-radius: 14px; box-shadow: 0 22px 40px -32px rgba(0, 0, 0, .9); }
.tt-chart-image { aspect-ratio: 4 / 3; padding: 10px; background: #eae3d4; border-bottom: 1px solid #d9cfba; }
.tt-chart-image img { display: block; width: 100%; height: 100%; object-fit: contain; background: white; }
.tt-chart-card-content { padding: 14px; }
.tt-chart-card h4 { min-height: 2.7em; margin: 0 0 13px; color: var(--tt-ink) !important; font-size: 14px !important; font-weight: 800 !important; line-height: 1.35 !important; }
.tt-chart-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-chart-actions button,
.tt-chart-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 7px 10px; color: var(--tt-ink) !important; background: transparent; border: 1px solid rgba(23, 55, 42, .24); border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 10px; font-weight: 850; }
.tt-chart-actions a { color: #342a15 !important; background: var(--tt-amber); border-color: #daa22f; }
.tt-chart-actions :is(button, a):hover { filter: brightness(.97); transform: translateY(-1px); }
.tt-chart-status { margin: 14px 0 0 !important; color: var(--tt-mint) !important; font-size: 11px !important; }

@media (max-width: 900px) {
  .tt-intro { grid-template-columns: 1fr; }
  .tt-benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tt-custom-panel { grid-template-columns: 1fr; }
  .tt-controls { position: static; }
  .tt-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #containerTable { min-height: min(1024px, 132vw); }
}

@media (max-width: 560px) {
  .tt-intro { padding: 26px 18px; }
  .tt-benefits { grid-template-columns: 1fr; gap: 0; }
  .tt-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; }
  .tt-tabs button { padding-inline: 8px; font-size: 10px; }
  .tt-custom-panel, .tt-chart-panel { padding: 13px; }
  .tt-input-row { grid-template-columns: 1fr; }
  #btnGenerate { width: 100%; }
  .tt-downloads { gap: 5px; }
  .tt-downloads button { padding-inline: 6px; }
  .tt-preview-shell { padding: 8px; border-radius: 12px; }
  #containerTable { min-height: 137vw; padding: 25px 20px; }
  #tableResult td { padding-block: 2.5px; }
  .tt-section-heading { grid-template-columns: 1fr; gap: 10px; }
  .tt-chart-grid { grid-template-columns: 1fr; }
  .tt-chart-card h4 { min-height: 0; }
}

@media print {
  body * { visibility: hidden !important; }
  #containerTable, #containerTable * { visibility: visible !important; }
  #containerTable { position: fixed; inset: 0; width: 100%; min-height: 100vh; border: 0; box-shadow: none; }
}
