/* 2048 calculators/tools — intentionally self-contained and lightweight. */
.g2048-tools-page {
  min-height: 70vh;
  background: #faf8ef;
  color: #403a34;
  padding-bottom: 48px;
}
.g2048-tools-topbar {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.g2048-tools-logo {
  color: #776e65;
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  text-decoration: none;
}
.g2048-tools-topnav { display: flex; align-items: center; gap: 8px; }
.g2048-tools-topnav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  color: #5e574f;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}
.g2048-tools-topnav a:hover,
.g2048-tools-topnav a:focus-visible { background: #eee4da; }
.g2048-tools-topnav a.is-primary { background: #8f7a66; color: #fff; }
.g2048-tools-article { max-width: 880px; margin: 0 auto; padding: 24px; }
.g2048-tools-hero { max-width: 760px; margin-bottom: 28px; }
.g2048-tools-back { display: inline-block; margin-bottom: 16px; color: #776e65; font-weight: 700; text-decoration: none; }
.g2048-tools-hero h1 { margin: 0 0 14px; color: #554d45; font-size: clamp(32px, 6vw, 52px); line-height: 1.04; letter-spacing: -0.035em; }
.g2048-tools-lede { margin: 0; max-width: 720px; font-size: 19px; line-height: 1.62; color: #655e57; }
.g2048-tools-privacy { margin: 14px 0 0; font-size: 13px; color: #7d746c; }
.g2048-tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 30px 0 40px; }
.g2048-tool-card { min-width: 0; padding: 20px; border: 1px solid #e2d8ce; border-radius: 16px; background: #fffdf9; text-decoration: none; color: #514a43; box-shadow: 0 8px 26px rgba(73,62,51,.05); }
.g2048-tool-card:hover, .g2048-tool-card:focus-visible { border-color: #bbada0; transform: translateY(-1px); }
.g2048-tool-card__icon { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 12px; background: #eee4da; color: #776e65; font-weight: 700; font-size: 18px; }
.g2048-tool-card strong { display: block; font-size: 18px; margin-bottom: 8px; }
.g2048-tool-card > span:not(.g2048-tool-card__icon) { display: block; line-height: 1.55; color: #6d655e; font-size: 14px; }
.g2048-tool-card small { display: block; margin-top: 18px; color: #8f7a66; font-weight: 700; font-size: 13px; }
.g2048-tool-panel { margin: 28px 0 42px; padding: 24px; border: 1px solid #ded4ca; border-radius: 18px; background: #fffdf9; box-shadow: 0 12px 36px rgba(73,62,51,.06); }
.g2048-tool-panel label { display: block; font-weight: 700; color: #554d45; }
.g2048-tool-panel textarea,
.g2048-tool-panel select,
.g2048-tool-panel input:not([data-board-cell]),
.g2048-board-input input {
  width: 100%;
  border: 1px solid #cfc4b8;
  border-radius: 10px;
  background: #fff;
  color: #403a34;
  font: inherit;
  font-size: 16px;
}
.g2048-tool-panel textarea { margin-top: 8px; padding: 14px; resize: vertical; line-height: 1.55; }
.g2048-tool-panel select,
.g2048-tool-panel input:not([data-board-cell]) { min-height: 46px; margin-top: 8px; padding: 0 12px; }
.g2048-tool-panel textarea:focus,
.g2048-tool-panel select:focus,
.g2048-tool-panel input:not([data-board-cell]):focus,
.g2048-board-input input:focus { outline: 3px solid rgba(143,122,102,.25); outline-offset: 1px; border-color: #8f7a66; }
.g2048-tool-help { margin: 8px 0 0; color: #7b726a; font-size: 13px; line-height: 1.5; }
.g2048-tool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.g2048-tool-button { min-height: 44px; border: 0; border-radius: 10px; padding: 0 16px; background: #eee4da; color: #5d554d; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.g2048-tool-button:hover, .g2048-tool-button:focus-visible { background: #e4d8cc; }
.g2048-tool-button.is-primary { background: #8f7a66; color: #fff; }
.g2048-tool-button.is-primary:hover, .g2048-tool-button.is-primary:focus-visible { background: #7d6957; }
.g2048-tool-results { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.g2048-tool-results.is-five { grid-template-columns: repeat(5, 1fr); }
.g2048-tool-results > div,
.g2048-board-summary > div { min-width: 0; padding: 14px; border-radius: 12px; background: #f4eee7; }
.g2048-tool-results span,
.g2048-board-summary span { display: block; min-height: 34px; color: #776e65; font-size: 12px; line-height: 1.35; font-weight: 700; }
.g2048-tool-results strong,
.g2048-board-summary strong { display: block; margin-top: 8px; color: #403a34; font-size: clamp(18px, 3.5vw, 26px); overflow-wrap: anywhere; }
.g2048-tool-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g2048-tool-path { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: #f8f4ee; line-height: 1.55; }
.g2048-tool-path span { display: block; margin-bottom: 6px; color: #776e65; font-size: 12px; font-weight: 700; }
.g2048-tool-path strong { font-size: 15px; overflow-wrap: anywhere; }
.g2048-tools-copy { max-width: 760px; }
.g2048-tools-copy section, .g2048-tools-copy > h2 { margin-top: 34px; }
.g2048-tools-copy h2 { margin-bottom: 10px; color: #554d45; font-size: 25px; line-height: 1.2; letter-spacing: -0.018em; }
.g2048-tools-copy p { margin: 0; color: #625b54; font-size: 16px; line-height: 1.76; }
.g2048-tools-faq details { border-top: 1px solid #ddd3c9; }
.g2048-tools-faq details:last-child { border-bottom: 1px solid #ddd3c9; }
.g2048-tools-faq summary { padding: 15px 0; cursor: pointer; font-weight: 700; color: #514a43; }
.g2048-tools-faq details p { padding: 0 0 16px; }
.g2048-board-input { width: min(100%, 480px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 0 auto; }
.g2048-board-input input { aspect-ratio: 1; min-width: 0; padding: 4px; text-align: center; font-weight: 700; font-size: clamp(16px, 4vw, 22px); appearance: textfield; }
.g2048-board-input input.is-invalid { border-color: #c75b4a; background: #fff5f2; }
.g2048-board-input input::-webkit-outer-spin-button,
.g2048-board-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.g2048-board-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.g2048-board-advice { margin-top: 14px; color: #625b54; font-size: 14px; line-height: 1.65; }
.g2048-board-directions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.g2048-board-directions span { display: block; padding: 10px; border-radius: 10px; background: #f7f2ec; text-align: center; font-size: 12px; color: #6d655e; }
.g2048-board-directions strong { display: block; margin-top: 4px; color: #514a43; font-size: 16px; }

.g2048-tool-status { min-height: 22px; margin: 10px 0 0; color: #71685f; font-size: 13px; line-height: 1.55; }
.g2048-tool-status.is-error { color: #9a3f34; }
.g2048-tool-status.is-success { color: #4d6d47; }
.g2048-tool-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; color: #776e65; font-size: 12px; font-weight: 700; }
.g2048-tool-presets button { min-height: 34px; border: 1px solid #d8cdc2; border-radius: 9px; padding: 0 10px; background: #f8f4ee; color: #5d554d; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.g2048-tool-presets button:hover, .g2048-tool-presets button:focus-visible { background: #eee4da; border-color: #bbada0; }
.g2048-board-paste { max-width: 480px; margin: 18px auto 0; padding-top: 16px; border-top: 1px solid #ece3da; }
.g2048-board-paste textarea { min-height: 76px; }
.g2048-board-paste .g2048-tool-button { margin-top: 10px; }
.g2048-board-directions span b { display: block; color: #6d655e; font-size: 12px; }
.g2048-board-directions span small { display: block; margin-top: 5px; color: #887e74; font-size: 11px; line-height: 1.35; }
.g2048-board-directions span.is-illegal { opacity: .62; }
.g2048-board-preview-wrap { margin-top: 18px; }
.g2048-board-preview-wrap h3 { margin: 0 0 10px; color: #655d55; font-size: 14px; line-height: 1.4; }
.g2048-board-preview { width: min(100%, 320px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.g2048-board-preview span { aspect-ratio: 1; min-width: 0; display: grid; place-items: center; border-radius: 8px; background: #eee4da; color: #554d45; font-size: clamp(12px, 3vw, 18px); font-weight: 700; overflow: hidden; }
.g2048-board-preview span:empty { background: #f4eee7; }
.g2048-board-preview span[data-value-length="5"], .g2048-board-preview span[data-value-length="6"] { font-size: clamp(10px, 2.5vw, 14px); }
.g2048-board-preview span[data-value-length="7"], .g2048-board-preview span[data-value-length="8"] { font-size: clamp(9px, 2.2vw, 12px); }

.g2048-tools-more { margin-top: 44px; padding-top: 30px; border-top: 1px solid #ddd3c9; }
.g2048-tools-more h2 { margin: 0 0 14px; font-size: 21px; color: #554d45; }
.g2048-tools-more__links { display: flex; flex-wrap: wrap; gap: 8px; }
.g2048-tools-more__links a { padding: 9px 12px; border-radius: 9px; background: #eee4da; color: #5d554d; font-size: 13px; font-weight: 700; text-decoration: none; }
@media (max-width: 720px) {
  .g2048-tools-topbar { padding: 14px 16px; align-items: flex-start; }
  .g2048-tools-topnav { max-width: calc(100vw - 90px); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .g2048-tools-topnav::-webkit-scrollbar { display: none; }
  .g2048-tools-topnav a { flex: 0 0 auto; min-height: 44px; }
  .g2048-tools-article { padding: 18px 16px 34px; }
  .g2048-tools-grid { grid-template-columns: 1fr; }
  .g2048-tool-panel { padding: 16px; }
  .g2048-tool-results, .g2048-tool-results.is-five { grid-template-columns: repeat(2, 1fr); }
  .g2048-board-directions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .g2048-tools-logo { font-size: 28px; }
  .g2048-tools-hero h1 { font-size: 34px; }
  .g2048-tools-lede { font-size: 17px; }
  .g2048-tool-field-grid { grid-template-columns: 1fr; }
  .g2048-tool-results, .g2048-tool-results.is-five, .g2048-board-summary { grid-template-columns: 1fr 1fr; }
  .g2048-tool-results span, .g2048-board-summary span { min-height: 0; }
}
