
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg, #f8f6ff);
  color: var(--text, #333);
  line-height: 1.7;
  padding-top: 3.5rem;
  transition: background 0.4s ease, color 0.4s ease;
}

.portfolio-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 2rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.portfolio-nav .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #7a7a7a;
  text-decoration: none;
  transition: color 0.3s ease;
}

.portfolio-nav .back-link:hover { color: #5b5ea6; }
.portfolio-nav .back-link svg { width: 16px; height: 16px; }

.portfolio-nav .nav-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #5b5ea6;
  color: #fff;
}

.wrapper {
  max-width: 860px;
  width: 90%;
  margin: 2rem auto 3rem;
}

.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--heading, #1a1a1a);
  margin-bottom: 0.4rem;
}

.page-header .subtitle {
  font-size: 0.95rem;
  color: var(--dim, #666);
}

.demo-section {
  background: var(--card-bg, rgba(255, 255, 255, 0.8));
  backdrop-filter: blur(8px);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.06));
  border-radius: 12px;
  padding: 1.8rem 2rem;
  margin-bottom: 1.5rem;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.demo-section h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  color: var(--heading, #1a1a1a);
  margin-bottom: 0.5rem;
}

.demo-section p {
  font-size: 0.9rem;
  color: var(--dim, #555);
  margin-bottom: 1rem;
}

.demo-section code {
  background: rgba(91, 94, 166, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #5b5ea6;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.hidden-box {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  background: rgba(91, 94, 166, 0.06);
  border-left: 3px solid #5b5ea6;
  border-radius: 0 8px 8px 0;
  display: none;
}

.hidden-box.visible { display: block; }

textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  resize: vertical;
  background: var(--input-bg, #fff);
  color: var(--text, #333);
}

textarea:focus { outline: 2px solid #5b5ea6; border-color: transparent; }

.counter {
  font-size: 0.82rem;
  color: var(--dim, #888);
  margin-top: 0.5rem;
}

.counter span { font-weight: 700; color: #5b5ea6; }

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-group input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--input-bg, #fff);
  color: var(--text, #333);
}

.input-group input:focus { outline: 2px solid #5b5ea6; border-color: transparent; }

#dynamic-list {
  list-style: none;
  padding: 0;
}

#dynamic-list li {
  padding: 0.5rem 1rem;
  margin-bottom: 0.4rem;
  background: rgba(91, 94, 166, 0.05);
  border-radius: 6px;
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#dynamic-list li .remove-btn {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.gallery-viewer {
  width: 100%;
  height: 200px;
  background: var(--input-bg, #f0f0f0);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.gallery-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
}

.gallery-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.gallery-thumbs img:hover { border-color: #5b5ea6; transform: scale(1.05); }

.calc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.calc-row input {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  background: var(--input-bg, #fff);
  color: var(--text, #333);
}

.calc-row select {
  padding: 0.5rem;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  font-size: 1rem;
  background: var(--input-bg, #fff);
  color: var(--text, #333);
}

.calc-result {
  font-size: 1.3rem;
  font-weight: 700;
  color: #5b5ea6;
  min-width: 40px;
}

body.theme-warm {
  --bg: #fff8f0;
  --text: #4a3520;
  --heading: #6b3a0a;
  --dim: #8b6940;
  --card-bg: rgba(255, 245, 230, 0.9);
  --border: rgba(180, 120, 60, 0.12);
  --input-bg: #fffbf5;
}

body.theme-cool {
  --bg: #f0f8ff;
  --text: #1a3a4a;
  --heading: #0a4a6b;
  --dim: #406a8b;
  --card-bg: rgba(230, 245, 255, 0.9);
  --border: rgba(60, 120, 180, 0.12);
  --input-bg: #f5fbff;
}

body.theme-dark {
  --bg: #1a1a2e;
  --text: #e0e0e0;
  --heading: #ffffff;
  --dim: #aaa;
  --card-bg: rgba(30, 30, 50, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --input-bg: #2a2a40;
}

body.theme-dark .portfolio-nav {
  background: rgba(26, 26, 46, 0.9);
  border-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .portfolio-nav .back-link { color: #aaa; }

@media (max-width: 600px) {
  .wrapper { width: 95%; }
  .demo-section { padding: 1.2rem 1.2rem; }
  .portfolio-nav { padding: 0.6rem 1rem; }
  .gallery-thumbs img { width: 48px; height: 48px; }
}
