@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Sora:wght@400;600;700;800&display=swap');

:root {
  --bg-top: #041e30;
  --bg-bottom: #0a4d73;
  --text: #e8f7ff;
  --text-strong: #ffffff;
  --muted: #b9d7e8;
  --card: rgba(8, 38, 58, 0.72);
  --card-soft: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.22);
  --shadow: 0 16px 40px rgba(2, 17, 28, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --accent: #00c2ff;
  --accent-2: #95f246;
  --accent-3: #ffd166;
  --danger: #ff7b9c;
  --ok: #88f0a6;
  --focus: 0 0 0 4px rgba(0, 194, 255, 0.22);
  --font-body: 'Sora', 'Segoe UI', Tahoma, sans-serif;
  --font-title: 'Bungee', 'Trebuchet MS', sans-serif;
}

html[data-theme='dark'] {
  --bg-top: #050b15;
  --bg-bottom: #121f33;
  --text: #dce7f3;
  --text-strong: #f7fbff;
  --muted: #9db1c7;
  --card: rgba(11, 20, 35, 0.78);
  --card-soft: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.16);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --accent: #52d5ff;
  --accent-2: #9be74f;
  --accent-3: #ffdc85;
  --danger: #ff91ad;
  --ok: #79e8a1;
  --focus: 0 0 0 4px rgba(82, 213, 255, 0.2);
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 10% -5%, rgba(255, 209, 102, 0.34) 0%, rgba(255, 209, 102, 0) 40%),
    radial-gradient(circle at 100% 0%, rgba(255, 71, 126, 0.28) 0%, rgba(255, 71, 126, 0) 38%),
    linear-gradient(140deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  filter: blur(1px);
}

body::before {
  width: 260px;
  height: 260px;
  left: -72px;
  top: 25%;
  background: radial-gradient(circle at 35% 35%, #fff1ca, #ff7f11);
  opacity: 0.62;
}

body::after {
  width: 210px;
  height: 210px;
  right: 7%;
  top: 8%;
  background: radial-gradient(circle at 35% 35%, #d7f8ff, #00c2ff);
  opacity: 0.62;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--text-strong);
}

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

h1,
h2,
h3 {
  margin: 0 0 10px;
  color: var(--text-strong);
}

h1 {
  font-family: var(--font-title);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}

.pageWrap {
  width: min(1220px, 100%);
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(8px, 1.4vw, 16px);
  display: grid;
  gap: 12px;
  align-content: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
}

.card.pad {
  padding: 16px;
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.09));
  color: var(--text-strong);
  padding: 10px 13px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
  box-shadow: 0 8px 20px rgba(2, 17, 28, 0.22);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn.primary {
  color: #062536;
  border-color: rgba(255, 209, 102, 0.45);
  background: linear-gradient(120deg, var(--accent-3), #ffb44e);
}

.btn.secondary {
  border-color: rgba(149, 242, 70, 0.35);
  background: linear-gradient(120deg, rgba(149, 242, 70, 0.35), rgba(149, 242, 70, 0.2));
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.btn.danger {
  border-color: rgba(255, 123, 156, 0.44);
  background: linear-gradient(120deg, rgba(255, 123, 156, 0.28), rgba(255, 123, 156, 0.18));
}

input,
select,
textarea,
.input {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: #082b43;
  padding: 10px 12px;
  border-radius: 12px;
  font: inherit;
}

html[data-theme='dark'] input,
html[data-theme='dark'] select,
html[data-theme='dark'] textarea,
html[data-theme='dark'] .input {
  background: rgba(8, 16, 31, 0.95);
  color: var(--text-strong);
}

input:focus,
select:focus,
textarea:focus,
.input:focus {
  outline: none;
  box-shadow: var(--focus);
  border-color: rgba(0, 194, 255, 0.45);
}

label {
  color: var(--text-strong);
}

.appShell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  padding: 16px;
  border-right: 1px solid var(--line);
  background: rgba(7, 33, 52, 0.64);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
  box-shadow: var(--shadow);
  color: var(--text-strong);
  font-family: var(--font-title);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.92rem;
}

.nav {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.navItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
}

.navItem:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-strong);
}

.navItem.active {
  border-color: rgba(0, 194, 255, 0.35);
  background: linear-gradient(120deg, rgba(0, 194, 255, 0.18), rgba(149, 242, 70, 0.14));
  color: var(--text-strong);
}

.main {
  padding: clamp(12px, 1.6vw, 22px);
  overflow: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.sectionFrame {
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 20px;
  box-shadow: var(--shadow);
  background: var(--card);
}

.skillsGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 18px;
}

@media (max-width: 1100px) { .skillsGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .skillsGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 650px) { .skillsGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.skillCard {
  text-align: left;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  color: var(--text-strong);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}

.skillCard:hover {
  border-color: rgba(0, 194, 255, 0.35);
  box-shadow: 0 12px 24px rgba(2, 17, 28, 0.24);
  transform: translateY(-1px);
}

.skillCard .title {
  font-weight: 800;
  font-size: 13px;
}

.skillCard .sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.skillCard.done {
  border-color: rgba(136, 240, 166, 0.42);
  background: linear-gradient(130deg, rgba(136, 240, 166, 0.22), rgba(136, 240, 166, 0.12));
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  border: 1px solid var(--line);
}

.bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
}

.lessonCard {
  padding: 14px;
}

.layout {
  width: min(1120px, 100%);
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
  align-content: start;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 14px;
  flex-wrap: wrap;
}

.row > * {
  min-width: 0;
}

.grid2 {
  gap: 14px;
  align-items: start;
}

.topbar {
  gap: 12px;
  flex-wrap: wrap;
}

.pageWrap > * {
  min-width: 0;
}

.formRow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.actionsRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.actionsRow.start {
  justify-content: flex-start;
}

.stack8 > * + * {
  margin-top: 8px;
}

.stack10 > * + * {
  margin-top: 10px;
}

.stack12 > * + * {
  margin-top: 12px;
}

.fullWidth {
  width: 100% !important;
}

.list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list > * {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
}

.hint,
.help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-strong);
}

.msg:empty {
  display: none;
}

.msg.success {
  border-color: rgba(136, 240, 166, 0.5);
  background: rgba(136, 240, 166, 0.2);
}

.msg.error {
  border-color: rgba(255, 123, 156, 0.52);
  background: rgba(255, 123, 156, 0.22);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
}

#topbar {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

#topbar button {
  margin-left: 10px;
}

.authPage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 14px;
}

.authShell {
  width: min(620px, 100%);
}

.authCard {
  padding: 20px;
}

.authHead {
  margin-bottom: 14px;
}

.authHead h1 {
  margin-bottom: 8px;
}

.authForm {
  display: grid;
  gap: 10px;
}

.authForm .btn {
  width: 100%;
}

.authModeRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.authModeRow .btn {
  width: auto;
}

.authFooter {
  margin-top: 12px;
  font-size: 13px;
}

.roleGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .roleGrid {
    grid-template-columns: 1fr;
  }
}

.roleOpt {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.08);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.roleOpt:hover {
  transform: translateY(-1px);
}

.roleOpt input {
  display: none;
}

.roleOpt .t {
  font-weight: 800;
  color: var(--text-strong);
}

.roleOpt .d {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.roleOpt.active {
  border-color: rgba(0, 194, 255, 0.5);
  box-shadow: var(--focus);
}

.menuBtn {
  margin-left: auto;
  display: none;
}

.menuBtn.btn {
  padding: 8px 10px;
  border-radius: 12px;
}

@supports (padding: max(0px)) {
  .sidebar { padding-top: max(12px, env(safe-area-inset-top)); }
  .main { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (max-width: 820px) {
  .appShell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 320px);
    border-right: 1px solid var(--line);
    padding: 12px;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .18s ease;
    background: rgba(7, 33, 52, 0.95);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.nav-open { transform: translateX(0); }

  .brand {
    border-radius: 14px;
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .menuBtn { display: inline-flex; }

  .nav {
    margin-top: 10px;
    flex-direction: column;
    gap: 8px;
  }

  .main {
    padding: 12px;
    overflow: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  .mobileTopbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(7, 33, 52, 0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }

  .mobileTopbar .title {
    color: var(--text-strong);
    font-family: var(--font-title);
    letter-spacing: 0.03em;
    font-size: 0.85rem;
  }

  .mobileTopbar .spacer { flex: 1; }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 40;
  }

  .overlay.show { display: block; }
}

@media (min-width: 821px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow: auto;
  }
}

/* Responsive safety layer: keeps pages usable when inline styles set fixed grid widths. */
img,
video,
svg,
iframe {
  max-width: 100%;
}

iframe:not([width]) {
  width: 100%;
  display: block;
}

.pageWrap,
.container,
.layout,
.main,
.card,
.card.pad {
  min-width: 0;
}

.card,
.main,
.pageWrap {
  overflow-wrap: anywhere;
}

textarea {
  max-width: 100%;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea,
.input {
  width: 100%;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

pre {
  max-width: 100%;
  overflow: auto;
}

@media (max-width: 980px) {
  .container,
  .pageWrap,
  .layout {
    width: 100%;
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .card.pad {
    padding: 12px;
  }

  #topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  #topbar button {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .formRow {
    grid-template-columns: 1fr;
  }

  .btn {
    max-width: 100%;
  }

  .row > * {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Collapse hard-coded inline grids/flex rows on small screens. */
  .pageWrap .card [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .pageWrap .card [style*="display:flex"] {
    flex-wrap: wrap !important;
  }

  .pageWrap .card [style*="min-width"] {
    min-width: 0 !important;
  }

  .pageWrap .card [style*="white-space:nowrap"] {
    white-space: normal !important;
  }
}

/* Professional polish layer (layout + readability, colors unchanged) */
html {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  line-height: 1.5;
}

.main {
  scroll-behavior: smooth;
}

.pageWrap > h1 {
  margin: 0 0 2px;
}

.pageWrap > :where(h2, h3) {
  margin-top: 0;
}

.pageWrap > * {
  min-width: 0;
}

.card {
  position: relative;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .2s ease, border-color .2s ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,0) 48%);
  opacity: .5;
}

.main .card:hover {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 20px 45px rgba(2, 17, 28, 0.36);
  transform: translateY(-1px);
}

.card.pad {
  padding: clamp(14px, 1.2vw, 20px);
}

.card.pad > :where(h1, h2, h3):first-child {
  margin-top: 0;
}

.badge,
.pill {
  font-weight: 700;
  letter-spacing: .01em;
}

.btn {
  min-height: 42px;
  letter-spacing: .01em;
}

.btn.secondary {
  backdrop-filter: blur(2px);
}

input::placeholder,
textarea::placeholder {
  color: rgba(24, 79, 109, 0.72);
}

html[data-theme='dark'] input::placeholder,
html[data-theme='dark'] textarea::placeholder {
  color: rgba(154, 180, 207, 0.8);
}

input,
select,
textarea,
.input {
  min-height: 42px;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 1px),
    calc(100% - 12px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.list {
  gap: 12px;
}

.list > * {
  border-radius: 15px;
}

.tableWrap {
  border-radius: 14px;
  overflow: hidden;
}

table th {
  font-weight: 800;
  letter-spacing: .03em;
}

table td {
  vertical-align: middle;
}

pre {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px;
  background: rgba(255,255,255,.06);
}

code {
  font-size: .92em;
}

.navItem {
  font-weight: 600;
}

.navItem.active {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .btn,
  .navItem {
    transition: none !important;
  }
}

@media (max-width: 980px) {
  .card.pad {
    padding: 14px;
  }

  .btn {
    min-height: 40px;
  }
}
