:root {
  --bg: #FFCE00; /* Playdate yellow */
  --surface: #FFFFFF;
  --border: #000000;
  --text: #000000;
  --accent: #FFCE00;
  --shadow: 6px 6px 0px 0px #000000;
  --shadow-hover: 2px 2px 0px 0px #000000;
  --shadow-small: 4px 4px 0px 0px #000000;
}

* {
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-weight: 500;
}

/* Navbar */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  border-bottom: 4px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}
nav .logo {
  font-size: 1.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -1px;
  cursor: pointer;
}
nav .links {
  display: flex;
  gap: 15px;
}

/* Buttons */
button {
  background: var(--surface);
  color: var(--text);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-small);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
button.primary {
  background: var(--text);
  color: var(--bg);
}
button:hover {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-hover);
}
button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

/* Hero */
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  background: var(--text);
  color: var(--surface);
}
#hero h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 900;
  margin: 0 0 20px 0;
  letter-spacing: -2px;
  line-height: 1.1;
  max-width: 900px;
  color: var(--accent);
}
#hero p {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  max-width: 700px;
  margin: 0 0 40px 0;
  font-weight: 600;
  line-height: 1.4;
}
#hero img {
  margin-top: 50px;
  max-width: 100%;
  width: 400px;
  border: 4px solid var(--border);
  border-radius: 12px;
  box-shadow: 6px 6px 0px 0px var(--accent);
  background: var(--surface);
}
.hero-btn {
  background: var(--accent);
  color: var(--text);
  border: 3px solid var(--accent);
  box-shadow: 6px 6px 0px 0px var(--surface);
  padding: 16px 32px;
  font-size: 1.2rem;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s ease;
}
.hero-btn:hover {
  box-shadow: 2px 2px 0px 0px var(--surface);
  transform: translate(4px, 4px);
}

/* Features */
#features {
  background: var(--bg); /* Yellow */
  padding: 60px 20px 80px;
  display: flex;
  justify-content: center;
  flex: 1;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1000px;
  width: 100%;
}
.feature-card {
  background: var(--surface);
  border: 4px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 30px;
  text-align: left;
}
.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  border-bottom: 3px solid var(--border);
  padding-bottom: 10px;
  color: var(--text);
}
.feature-card p {
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0;
  color: var(--text);
}

/* Modal Login */
#login-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

#login {
  background: var(--bg);
  border: 4px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  padding: 30px;
  position: relative;
  display: none; /* Controlled by JS / Overlay */
  flex-direction: column;
  gap: 20px;
  margin: auto; /* for when it's flexed inside the overlay */
}
.close-btn {
  position: absolute;
  top: 15px; right: 15px;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 2rem;
  padding: 0;
  margin: 0;
  min-width: auto;
  line-height: 1;
}
.close-btn:hover {
  transform: scale(1.1);
  box-shadow: none;
}

/* Form Elements */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 15px;
  border: 3px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff9d6;
}

h2, h3 {
  color: var(--text);
  margin-top: 0;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -1px;
}

/* App container */
#app {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 30px;
}

.section {
  background: var(--surface);
  border: 4px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 24px;
}
.section h3 {
  font-size: 1.4rem;
  margin-bottom: 20px;
  border-bottom: 3px solid var(--border);
  padding-bottom: 10px;
}

/* Avatar Canvas */
#char-avatar-canvas {
  background: #95a5a6;
  border: 4px solid var(--border);
  image-rendering: pixelated;
  border-radius: 8px;
  margin-bottom: 15px;
  width: 100%;
  max-width: 300px;
  box-shadow: var(--shadow-small);
}

/* Utility */
.link {
  color: var(--text);
  text-decoration: underline;
  font-weight: 800;
  cursor: pointer;
}
.link:hover {
  color: #333;
}

/* Store items overrides dynamically generated by user.js */
#storeCharactersList > div {
  background: var(--surface) !important;
  border: 3px solid var(--border) !important;
  box-shadow: var(--shadow-small) !important;
  color: var(--text) !important;
}
#storeCharactersList > div > div:first-child {
  color: var(--text) !important;
  font-size: 1.2rem;
  font-weight: 900 !important;
}
#storeCharactersList > div > div:nth-child(2) {
  color: #444 !important;
  font-weight: 600;
}
#storeCharactersList > div span {
  color: var(--text) !important;
  font-weight: 900 !important;
}
#storeCharactersList > div button {
  background: var(--accent) !important;
  color: var(--text) !important;
}

/* Library items override */
#userCharactersList {
  background: var(--surface) !important;
  border: 3px solid var(--border) !important;
  box-shadow: inset 4px 4px 0px rgba(0,0,0,0.05);
}
