:root {
  --bg: #0f1117; --fg: #e8eaf0; --muted: #9aa0b4;
  --card: #1a1d27; --accent: #7c9cff;
}
:root[data-theme="light"] {
  --bg: #fafbff; --fg: #1a1d27; --muted: #5b6075;
  --card: #ffffff; --accent: #3b5bdb;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
.site-header {
  position: sticky; top: 0; display: flex; justify-content: space-between;
  align-items: center; padding: 1rem 2rem; background: var(--bg);
  border-bottom: 1px solid var(--card); z-index: 10;
}
.logo { font-weight: 700; color: var(--fg); }
nav { display: flex; gap: 1.2rem; align-items: center; }
#theme-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; }
section { max-width: 900px; margin: 0 auto; padding: 4rem 2rem; }
.hero { text-align: center; padding-top: 7rem; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.5rem); margin: 0; }
.accent { color: var(--accent); }
.btn {
  display: inline-block; margin-top: 1rem; padding: .7rem 1.4rem;
  background: var(--accent); color: var(--bg); border-radius: 8px; font-weight: 600;
}
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.tags li { background: var(--card); padding: .3rem .9rem; border-radius: 999px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card { background: var(--card); padding: 1.2rem; border-radius: 12px; }
.card h3 { margin-top: 0; }
.project { padding-top: 3rem; }
.project .lead { color: var(--muted); font-size: 1.15rem; }
.project-nav { display: flex; justify-content: space-between; margin-top: 3rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.gallery img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px;
  cursor: zoom-in; transition: transform .2s;
}
.gallery img:hover { transform: scale(1.03); }
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .9);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
.weather {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  background: var(--card); color: var(--fg); padding: .75rem 1rem;
  border-radius: 14px; border: 1px solid var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.dino-wrap { max-width: 600px; }
#dino {
  width: 100%; height: auto; background: var(--card); border-radius: 12px;
  border: 1px solid var(--accent); outline: none; touch-action: manipulation;
}
.dino-score { margin-top: .5rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.coin-game { max-width: 600px; margin-bottom: 2rem; }
.coin {
  width: 110px; height: 110px; border-radius: 50%; margin: 1rem 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; font-weight: 800; color: #5c4400;
  background: radial-gradient(circle at 30% 30%, #ffe27a, #d9a400);
  border: 4px solid #b78500; box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.coin.flipping { animation: coin-flip .9s ease-in-out; }
@keyframes coin-flip {
  0% { transform: translateY(0) rotateY(0); }
  50% { transform: translateY(-40px) rotateY(900deg); }
  100% { transform: translateY(0) rotateY(1800deg); }
}
.coin-controls { display: flex; gap: .75rem; }
.coin-controls .btn { border: none; cursor: pointer; margin-top: 0; font-size: 1rem; }
.coin-controls .btn:disabled { opacity: .5; cursor: wait; }
.coin-result { font-weight: 600; min-height: 1.6em; }
.game-box { max-width: 600px; margin-bottom: 2rem; }
.game-btn { border: none; cursor: pointer; margin-top: .5rem; font-size: 1rem; }
.game-label { color: var(--muted); font-size: .85rem; }
.dice-row { display: flex; gap: 2.5rem; }
.dice { font-size: 3rem; line-height: 1.2; }
.ttt-board { display: grid; grid-template-columns: repeat(3, 80px); gap: 6px; margin-bottom: .5rem; }
.ttt-cell {
  height: 80px; font-size: 2.4rem; font-weight: 800; cursor: pointer;
  background: var(--card); color: var(--fg); border: 1px solid var(--accent); border-radius: 8px;
}
.ttt-cell:disabled { cursor: default; }
.balloon-bar { display: flex; gap: 1.5rem; color: var(--muted); margin-bottom: .5rem; }
.balloon-field {
  position: relative; height: 300px; overflow: hidden; border-radius: 12px;
  background: var(--card); border: 1px solid var(--accent);
}
.balloon {
  position: absolute; bottom: -60px; width: 40px; height: 50px; border-radius: 50% 50% 48% 48%;
  cursor: pointer; border: none; padding: 0; transition: transform .1s;
}
.balloon:active { transform: scale(.85); }
.wordle-grid { display: grid; grid-template-rows: repeat(6, 1fr); gap: 5px; margin-bottom: .75rem; width: max-content; }
.wordle-row { display: grid; grid-template-columns: repeat(5, 48px); gap: 5px; }
.wordle-tile {
  height: 48px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.4rem; text-transform: uppercase;
  border: 2px solid var(--muted); border-radius: 4px;
}
.wordle-tile.correct { background: #2fb36b; border-color: #2fb36b; color: #fff; }
.wordle-tile.present { background: #c9a227; border-color: #c9a227; color: #fff; }
.wordle-tile.absent { background: var(--muted); border-color: var(--muted); color: #fff; }
.wordle-form { display: flex; gap: .5rem; align-items: center; }
.wordle-form input {
  padding: .5rem; font-size: 1rem; text-transform: uppercase; width: 8rem;
  background: var(--card); color: var(--fg); border: 1px solid var(--accent); border-radius: 6px;
}
.sudoku-grid { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 405px); border: 2px solid var(--fg); margin-bottom: .5rem; }
.sudoku-cell {
  aspect-ratio: 1; width: 100%; text-align: center; font-size: 1.2rem; padding: 0;
  background: var(--card); color: var(--fg); border: 1px solid var(--muted); border-radius: 0;
}
.sudoku-cell:disabled { font-weight: 800; opacity: 1; -webkit-text-fill-color: var(--fg); background: var(--bg); }
.sudoku-cell.c3 { border-right: 2px solid var(--fg); }
.sudoku-cell.r3 { border-bottom: 2px solid var(--fg); }
.sudoku-cell.bad { background: rgba(229, 72, 77, .35); }
.stock {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  width: 15.5rem; background: var(--card); color: var(--fg); padding: .5rem .9rem;
  border-radius: 12px; border: 1px solid var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.stock-symbol { font-weight: 700; }
.stock-name { font-size: .7rem; color: var(--muted); }
.stock-quote { text-align: right; }
.stock-price { font-weight: 700; }
.stock-change { font-size: .75rem; color: var(--muted); }
.stock-change.up { color: #2fb36b; }
.stock-change.down { color: #e5484d; }
.weather {
  bottom: 6.5rem;
}
.weather-icon { font-size: 2rem; }
.weather-temp { font-size: 1.3rem; font-weight: 700; }
.weather-desc { font-size: .8rem; color: var(--muted); }
footer { text-align: center; color: var(--muted); padding: 2rem; }
