/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #d7e0ea;
  --success: #15803d;
  --code-bg: #0f172a;
  --code-text: #e5ecf4;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 900px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 2rem 1rem;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 240px);
}

main,
body > h1,
body > p,
body > ul,
body > form,
body > table,
body > section,
body > hr,
body > .exercise-container {
  width: min(100%, var(--max-width));
  margin-left: auto;
  margin-right: auto;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  margin-top: 0;
  margin-bottom: 1rem;
  color: #0f172a;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  color: #12315f;
}

h3 {
  font-size: 1.15rem;
  color: #12315f;
}

p {
  margin-top: 0;
  color: var(--text);
}

ul,
ol {
  padding-left: 1.4rem;
}

li + li {
  margin-top: 0.35rem;
}

a {
  color: var(--primary);
}

a:hover,
a:focus {
  color: var(--primary-dark);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem auto;
}

.exercise-container,
form,
table,
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.exercise-container,
section {
  padding: 2rem;
}

.instructions {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.instructions h2,
.instructions h3 {
  margin-top: 0;
}

.workspace {
  background: #fcfdff;
  border: 2px dashed #bfd4ea;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  min-height: 160px;
}

table {
  width: min(100%, var(--max-width));
  border-collapse: collapse;
  overflow: hidden;
  margin-top: 1rem;
}

caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #12315f;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.85rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eff6ff;
  color: #0f172a;
}

form {
  width: min(100%, var(--max-width));
  padding: 1.5rem;
  margin-top: 1rem;
}

fieldset {
  border: 1px solid #bfd4ea;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0 0 1rem;
}

legend {
  font-weight: 700;
  color: #12315f;
  padding: 0 0.5rem;
}

label {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

input,
textarea,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid #c7d2e0;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 1rem;
}

input[type="checkbox"],
input[type="radio"] {
  margin-right: 0.5rem;
}

button,
input[type="submit"],
input[type="reset"] {
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 0.85rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover,
button:focus,
input[type="submit"]:hover,
input[type="submit"]:focus,
input[type="reset"]:hover,
input[type="reset"]:focus {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid #1e293b;
}

code {
  font-family: "Courier New", Courier, monospace;
}

textarea.code-editor {
  min-height: 280px;
  font-family: "Courier New", Courier, monospace;
  background: #0f172a;
  color: #e5ecf4;
  border: 1px solid #1e293b;
}

.status-bar {
  width: min(100%, var(--max-width));
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: var(--success);
  border-radius: 10px;
  font-size: 0.95rem;
}

.actions {
  width: min(100%, var(--max-width));
  margin: 1rem auto 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.actions button.secondary {
  background: #475569;
}

.actions button.secondary:hover,
.actions button.secondary:focus {
  background: #334155;
}

small,
.helper-text {
  color: var(--muted);
}

@media (max-width: 768px) {
  body {
    padding: 1rem 0.75rem;
  }

  .exercise-container,
  section,
  form {
    padding: 1rem;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }
}
