:root {
  --ink: #111827;
  --muted: #4b5563;
  --line: #dbe4f0;
  --line-strong: #b8c8dc;
  --surface: #ffffff;
  --surface-soft: #f6f9fe;
  --surface-tint: #edf5ff;
  --blue: #2563eb;
  --blue-dark: #1247b8;
  --blue-soft: #dbeafe;
  --green: #137a49;
  --green-soft: #e8f7ef;
  --red: #b42318;
  --shadow: 0 14px 35px rgba(20, 54, 100, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fff 0, #f6f9ff 34rem, #fff 34rem);
  line-height: 1.58;
}

a { color: #034eaa; }
a:hover { color: var(--blue-dark); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .62; }
code {
  padding: .08rem .34rem;
  border-radius: .35rem;
  background: #eff4fb;
  color: #1f3d67;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .94em;
}

.site-header {
  width: min(1160px, calc(100% - 2rem));
  min-height: 4.8rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.05rem; }
.brand:hover { color: var(--blue-dark); }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .65rem; background: var(--blue); color: #fff; font-weight: 800; box-shadow: 0 4px 12px rgba(37,99,235,.26); }
.site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .2rem .45rem; font-size: .93rem; }
.site-nav a { padding: .35rem .5rem; border-radius: .5rem; color: #34455f; text-decoration: none; }
.site-nav a:hover { color: var(--blue-dark); background: var(--blue-soft); }

.hero { width: min(900px, calc(100% - 2rem)); margin: 2.2rem auto 2.6rem; text-align: center; }
.eyebrow, .section-kicker { margin: 0; color: var(--blue-dark); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { margin: .28rem 0 .4rem; font-size: clamp(2.1rem, 5vw, 3.5rem); letter-spacing: -.055em; line-height: 1.05; }
.lead { max-width: 680px; margin: 0 auto; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); }
.hero-code { display: flex; justify-content: center; align-items: center; gap: .4rem; margin: 1.55rem 0 .52rem; }
.hero-code > span { display: grid; place-items: center; width: 2.6rem; height: 3rem; border: 1px solid var(--line-strong); border-radius: .7rem; background: #fff; font-weight: 800; font-size: 1.4rem; box-shadow: 0 5px 10px rgba(26,58,104,.05); }
.hero-code strong { margin-left: .8rem; display: flex; gap: .28rem; }
.hero-code strong i, .hero-code strong b, .feedback-inline i, .feedback-inline b { display: inline-grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: .55rem; font-style: normal; font-size: .92rem; }
.hero-code strong i, .feedback-inline i { background: #e4eefc; color: #0c4cb8; }
.hero-code strong b, .feedback-inline b { background: #fff0dd; color: #9d4b00; }
.hero-caption { margin: 0; color: var(--muted); font-size: .92rem; }

.game-shell, .content-section, .services-section { width: min(1160px, calc(100% - 2rem)); margin: 0 auto 2.8rem; }
.game-shell { padding: clamp(1rem, 3vw, 1.8rem); border: 1px solid var(--line); border-radius: 1.45rem; background: rgba(255,255,255,.93); box-shadow: var(--shadow); }
.game-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.game-toolbar h2, .content-heading h2 { margin: .15rem 0 0; font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.03em; line-height: 1.2; }
.global-status { min-height: 1.55rem; margin: .8rem 0 1.15rem; color: var(--muted); font-size: .94rem; }
.status-success { color: var(--green); font-weight: 650; }
.status-error { color: var(--red); font-weight: 650; }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.game-card { min-width: 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card-heading { display: flex; gap: .75rem; align-items: center; margin-bottom: .55rem; }
.card-heading h3 { margin: .08rem 0 0; font-size: 1.22rem; line-height: 1.2; }
.card-badge { display: grid; place-items: center; flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); font-weight: 800; }
.muted, .field-help { color: var(--muted); }
.muted { margin: .45rem 0 1rem; font-size: .94rem; }

label { display: block; margin: .9rem 0 .35rem; color: #27364a; font-weight: 700; font-size: .92rem; }
.input-row { display: flex; gap: .55rem; }
input[type="text"] { width: 100%; min-width: 0; padding: .72rem .85rem; border: 1px solid var(--line-strong); border-radius: .65rem; color: var(--ink); background: #fff; letter-spacing: .12em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.08rem; font-weight: 700; }
input[type="text"]:focus { outline: 3px solid rgba(37,99,235,.2); border-color: var(--blue); }
.field-help { margin: .36rem 0 0; font-size: .82rem; }
.form-error { min-height: 1.25rem; margin: .36rem 0 0; color: var(--red); font-size: .87rem; font-weight: 650; }
.button { border: 1px solid transparent; border-radius: .66rem; padding: .7rem .9rem; font-weight: 750; white-space: nowrap; transition: transform .14s ease, box-shadow .14s ease, background .14s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--blue); box-shadow: 0 4px 10px rgba(37,99,235,.22); }
.button-primary:hover:not(:disabled) { background: var(--blue-dark); }
.button-secondary { color: #15375f; border-color: var(--line-strong); background: #fff; }
.button-secondary:hover:not(:disabled), .button-outline:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
.button-outline { width: 100%; margin-top: 1rem; color: #124d9a; border-color: #91b6ec; background: #f6faff; }
.button-wide { padding-block: .76rem; }
.current-result { display: flex; align-items: center; gap: .45rem; min-height: 3.15rem; margin-top: 1rem; padding: .65rem .75rem; border: 1px dashed var(--line-strong); border-radius: .7rem; background: var(--surface-soft); }
.current-result-success { display: block; border-style: solid; border-color: #a9dfc2; background: var(--green-soft); }
.win-message { display: inline-block; margin: .45rem 0 0; color: var(--green); }

.mode-switch { margin: .9rem 0; padding: .7rem .75rem .75rem; border: 1px solid var(--line); border-radius: .75rem; }
.mode-switch legend { padding: 0 .35rem; color: #34455f; font-size: .85rem; font-weight: 750; }
.radio-option { display: flex; gap: .58rem; align-items: flex-start; margin: .45rem 0; padding: .35rem; cursor: pointer; font-weight: 400; }
.radio-option input { margin-top: .25rem; accent-color: var(--blue); }
.radio-option strong { display: block; color: var(--ink); font-size: .9rem; }
.radio-option small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.36; }
.automatic-secret-box { margin: .85rem 0 0; padding: .15rem .75rem .8rem; border: 1px solid #c9dcf4; border-radius: .75rem; background: #f7fbff; }
.computer-play-area { margin-top: 1.1rem; padding: 1rem; border: 1px solid #bed4f3; border-radius: .85rem; background: #f7fbff; }
.computer-label { margin: 0; color: var(--muted); font-size: .83rem; font-weight: 750; text-align: center; text-transform: uppercase; letter-spacing: .07em; }
.computer-code { margin: .05rem 0 .3rem; text-align: center; color: #153c72; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 2.05rem; font-weight: 850; letter-spacing: .2em; }
.computer-analysis { min-height: 1.4rem; margin: 0 auto .75rem; color: var(--muted); text-align: center; font-size: .84rem; }
.feedback-question { margin: .65rem 0 .12rem; font-weight: 750; }
.feedback-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.1rem,1fr)); gap: .45rem; margin-top: .75rem; }
.feedback-choice { display: flex; align-items: center; justify-content: center; gap: .25rem; min-height: 2.65rem; border: 1px solid var(--line-strong); border-radius: .6rem; background: #fff; }
.feedback-choice:hover { border-color: var(--blue); background: #eff6ff; }
.feedback-choice small { color: var(--muted); font-size: .68rem; }
.feedback-token { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .18rem; border-radius: .45rem; font-weight: 850; font-size: .82rem; line-height: 1; }
.token-x { color: #0c4cb8; background: #e4eefc; }
.token-o { color: #9d4b00; background: #fff0dd; }
.token-none { color: #4b5563; background: #edf1f6; }
.feedback-inline { display: inline-flex; gap: .22rem; vertical-align: middle; }

.history-list { display: grid; gap: .35rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.history-list:empty { display: none; }
.history-list li { display: grid; grid-template-columns: 4.2rem 1fr auto; align-items: center; gap: .5rem; padding: .48rem .55rem; border-radius: .55rem; background: var(--surface-soft); font-size: .86rem; }
.history-list li > code { justify-self: start; font-size: 1rem; letter-spacing: .08em; }
.history-feedback { display: flex; flex-wrap: wrap; gap: .15rem; }
.history-list small { color: var(--muted); font-size: .73rem; text-align: right; }

.content-section, .services-section { padding: clamp(1.1rem, 3vw, 2rem); border-radius: 1.25rem; }
.content-section { background: #fff; border: 1px solid var(--line); }
.content-section.tint { border-color: #cce0fb; background: var(--surface-tint); }
.content-heading { margin-bottom: 1rem; }
.content-section h3 { margin: 1.45rem 0 .4rem; font-size: 1.16rem; }
.content-section p { max-width: 930px; }
.text-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(260px,.8fr); gap: 1.2rem; align-items: start; }
.legend-list { display: grid; gap: .5rem; margin: 0; }
.legend-list div { display: grid; grid-template-columns: 2.2rem 1fr; gap: .45rem; align-items: center; padding: .58rem .65rem; border-radius: .7rem; background: var(--surface-soft); }
.legend-list dt, .legend-list dd { margin: 0; }
.legend-list dd { color: #34455f; font-size: .9rem; }
.example-box { margin-top: 1.1rem; padding: 1rem 1.15rem; border-left: 4px solid var(--blue); border-radius: 0 .85rem .85rem 0; background: #f8fbff; }
.example-box h3 { margin: 0 0 .55rem; }
.example-row { display: grid; grid-template-columns: 8.5rem 1fr; gap: .5rem; margin: .2rem 0; }
.info-card { padding: 1rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface-soft); }
.info-card h3 { margin: 0 0 .35rem; }
.info-card p { margin: 0; color: #34455f; }

.faq-section details { border-bottom: 1px solid var(--line); }
.faq-section details:last-child { border-bottom: 0; }
.faq-section summary { padding: .8rem .1rem; cursor: pointer; color: #18365f; font-weight: 750; }
.faq-section details p { margin: 0 0 .9rem; color: var(--muted); }
.services-section { padding-inline: 0; }
.services-intro { margin: .5rem 0 0; color: var(--muted); }
.service-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.service-card { display: grid; align-content: start; gap: .34rem; min-height: 10rem; padding: 1rem; border: 1px solid var(--line); border-radius: .95rem; color: var(--ink); background: #fff; text-decoration: none; box-shadow: 0 5px 16px rgba(20,54,100,.04); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.service-card:hover, .service-card:focus-visible { border-color: #8bb5ee; color: var(--ink); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,54,100,.09); }
.service-icon { display: block; width: 2.8rem; height: 2.8rem; margin-bottom: .18rem; border-radius: .68rem; object-fit: contain; }
.service-card strong { font-size: 1rem; }
.service-card small { color: var(--muted); line-height: 1.35; }
.service-card-eet { border-color: #f2d7a7; background: #fffdf8; }
.site-footer { margin-top: .4rem; padding: 2.3rem 1rem 1.6rem; color: #eaf6f2; background: #173b35; }
.footer-inner { width: min(1160px, 100%); margin: 0 auto; display: grid; grid-template-columns: 1.15fr 1.05fr .9fr; gap: 2rem; text-align: left; }
.site-footer h2 { margin: 0 0 .72rem; color: #fff; font-size: 1rem; }
.site-footer p { margin: .42rem 0; color: #d5e6df; font-size: .9rem; line-height: 1.5; }
.site-footer a { color: #d8f5e6; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { color: #fff; text-decoration: underline; }
.footer-projects { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.footer-projects a { display: inline-flex; align-items: center; gap: .5rem; min-height: 1.65rem; font-size: .9rem; }
.footer-projects img { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 5px; object-fit: contain; }
.footer-meta { font-size: .9rem; }

@media (max-width: 760px) {
  .site-header { flex-direction: column; justify-content: center; padding: .85rem 0 .55rem; }
  .site-nav { justify-content: center; }
  .hero { margin-top: 1.35rem; }
  .game-toolbar, .game-grid, .text-grid { grid-template-columns: 1fr; display: grid; }
  .game-toolbar { gap: .85rem; }
  .game-toolbar .button { width: 100%; }
  .input-row { flex-wrap: wrap; }
  .input-row .button { width: 100%; }
  .service-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .footer-inner { grid-template-columns: 1fr; gap: 1.35rem; text-align: center; }
  .footer-projects { align-items: center; }
}

@media (max-width: 440px) {
  .game-shell, .content-section { width: min(100% - 1rem, 1160px); padding: 1rem; }
  .services-section { width: min(100% - 1rem, 1160px); }
  .game-card { padding: 1rem; }
  .feedback-options { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .history-list li { grid-template-columns: 3.9rem 1fr; }
  .history-list small { grid-column: 1 / -1; text-align: left; }
  .example-row { grid-template-columns: 6.5rem 1fr; }
}

/* Liczby: ręczne wprowadzanie sekwencji X/O */
.alternate-title { display: inline-block; color: #56708f; font-size: .66em; font-weight: 680; letter-spacing: -.02em; white-space: nowrap; }
.button:disabled,
.feedback-entry-button:disabled,
.feedback-choice:disabled { cursor: not-allowed; opacity: .52; }
.manual-feedback-builder { margin-top: .8rem; padding: .8rem; border: 1px solid #c9dcf4; border-radius: .75rem; background: #fff; }
.manual-feedback-preview-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; min-height: 2.8rem; padding: .45rem .55rem; border-radius: .6rem; background: var(--surface-soft); color: #33455e; font-size: .86rem; font-weight: 720; }
.manual-feedback-preview { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .22rem; min-height: 1.6rem; color: var(--ink); font-size: 1rem; }
.manual-feedback-preview.is-placeholder { color: var(--muted); font-size: .84rem; font-weight: 600; }
.manual-feedback-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin: .65rem 0; }
.feedback-entry-button { min-height: 2.65rem; border: 1px solid var(--line-strong); border-radius: .6rem; font-weight: 820; transition: transform .14s ease, border-color .14s ease, filter .14s ease; }
.feedback-entry-button:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--blue); filter: brightness(.98); }
.feedback-edit-button { min-height: 2.65rem; font-size: .86rem; }
.feedback-shortcuts { margin-top: .8rem; border-top: 1px solid var(--line); }
.feedback-shortcuts summary { padding-top: .75rem; cursor: pointer; color: #244a78; font-size: .86rem; font-weight: 720; }
.feedback-shortcuts .feedback-options { margin-top: .55rem; }

@media (max-width: 440px) {
  .manual-feedback-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manual-feedback-controls .feedback-entry-button:nth-child(3) { grid-column: 1 / -1; }
}
