* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f7f8fa;
  color: #1f2933;
  line-height: 1.5;
}

header {
  background: linear-gradient(135deg, #2c5282, #2b6cb0);
  color: white;
  padding: 1.25rem 2rem;
}

header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }
.subtitle { margin: 0.25rem 0 0; opacity: 0.85; font-size: 0.9rem; }

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 2rem;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.tab {
  background: none;
  border: none;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  cursor: pointer;
  color: #4a5568;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}

.tab:hover { color: #2b6cb0; }

.tab.active {
  color: #2b6cb0;
  border-bottom-color: #2b6cb0;
  font-weight: 600;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 2rem 6rem;
}

.panel { display: none; }
.panel.active { display: block; }

h2 { margin-top: 0; color: #2d3748; }

.hint {
  background: #ebf8ff;
  border-left: 3px solid #4299e1;
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.hint code {
  background: white;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

input[type="text"], select {
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: white;
  font-family: inherit;
}

input[type="text"] {
  flex: 1;
  min-width: 200px;
}

input:focus, select:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

button {
  padding: 0.55rem 1.2rem;
  font-size: 0.95rem;
  background: #2b6cb0;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}

button:hover { background: #2c5282; }
button:active { transform: translateY(1px); }

.link-btn {
  background: none;
  color: #2b6cb0;
  padding: 0.25rem 0;
  font-size: 0.85rem;
  text-decoration: underline;
}
.link-btn:hover { background: none; color: #2c5282; }

.mode-row { margin-top: -0.5rem; margin-bottom: 1rem; }
.mode-label { font-size: 0.85rem; color: #4a5568; }
.mode-toggle {
  display: inline-flex;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  overflow: hidden;
  background: white;
}
.mode-btn {
  background: white;
  color: #4a5568;
  border: none;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 0;
  font-weight: 500;
  cursor: pointer;
}
.mode-btn + .mode-btn { border-left: 1px solid #cbd5e0; }
.mode-btn:hover { background: #edf2f7; color: #2b6cb0; }
.mode-btn.active {
  background: #2b6cb0;
  color: white;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 800px) {
  .result-grid { grid-template-columns: 1fr; }
}

.canvas-wrap, .info-box {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  min-height: 380px;
}

canvas {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  background: white;
}

.info-box h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: #4a5568;
}

dl { margin: 0; }
dt { font-weight: 600; font-size: 0.85rem; color: #718096; margin-top: 0.5rem; }
dd { margin: 0.1rem 0 0; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.9rem; }

.error {
  color: #c53030;
  background: #fff5f5;
  border-left: 3px solid #c53030;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  display: none;
  font-size: 0.9rem;
}
.error.show { display: block; }

.task {
  background: #fffaf0;
  border: 1px solid #fbd38d;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  margin: 1rem 0;
}

.task .label { font-weight: 600; color: #c05621; }

.feedback {
  margin-top: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  display: none;
}
.feedback.show { display: block; }
.feedback.correct { background: #f0fff4; border-left: 3px solid #38a169; color: #22543d; }
.feedback.incorrect { background: #fff5f5; border-left: 3px solid #c53030; color: #742a2a; }
.feedback ol { margin: 0.4rem 0 0 1.2rem; padding: 0; }
.feedback li { margin: 0.2rem 0; }

.score {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #718096;
}

.iso-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 800px) { .iso-grid { grid-template-columns: 1fr; } }

.iso-grid > div {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.8rem;
}
.iso-grid input { width: 100%; margin-bottom: 0.6rem; }
.mini-info {
  font-size: 0.85rem;
  font-family: ui-monospace, monospace;
  color: #4a5568;
  margin-top: 0.5rem;
}

.iso-result {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: none;
}
.iso-result.show { display: block; }
.iso-result .verdict { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.iso-result .verdict.yes { color: #22543d; }
.iso-result .verdict.no { color: #742a2a; }

.rules { line-height: 1.7; }
.rules li { margin-bottom: 0.4rem; }
.rules code { background: #edf2f7; padding: 0.1rem 0.35rem; border-radius: 3px; }

footer {
  text-align: center;
  padding: 1.5rem;
  color: #718096;
  font-size: 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: white;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10;
}
footer a { color: #2b6cb0; }
