* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background: var(--bg-color, #14100c);
  color: var(--text-color, #ddd8f0);
  font-family: var(--font-body, 'JetBrains Mono', monospace);
}

#workshop-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#workshop-bg .wall {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(0, 0, 0, 0.18) 23px, rgba(0, 0, 0, 0.18) 25px),
              repeating-linear-gradient(90deg, transparent, transparent 58px, rgba(0, 0, 0, 0.12) 58px, rgba(0, 0, 0, 0.12) 60px),
              linear-gradient(180deg, #1e1810 0%, #1a1610 100%);
}

#workshop-bg .wall::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 200, 100, 0.07) 0%, transparent 60%),
              linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.35) 100%);
}

#workshop-bg .floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 180px;
  background: repeating-linear-gradient(90deg, #1a1208 0px, #221a0c 3px, #1e1610 60px, #181008 63px, #211908 120px, #1c1408 123px, #201608 180px);
  opacity: 0.7;
  transform: perspective(300px) rotateX(8deg);
  transform-origin: bottom;
}

#window {
  position: relative;
  z-index: 1;
  height: 140px;
  margin: 0;
  overflow: hidden;
  flex-shrink: 0;
}

#window .frame-outer {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, #1a1208 0px, #1e1508 2px, #1a1208 4px, #211a0a 20px, #1a1208 22px, #1c1409 40px);
  border-bottom: 8px solid #2a1e0a;
  box-shadow: inset 0 -8px 24px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.6);
}

#window .glass {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  bottom: 8px;
  overflow: hidden;
  border-radius: 3px 3px 0 0;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

#window .sky {
  position: absolute;
  inset: 0;
  transition: background 2s;
}

#window .sun-moon {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transform: translateX(-50%);
  transition: left 60s linear, top 1s, background 2s, box-shadow 2s;
}

#window .stars {
  position: absolute;
  inset: 0;
}

#window .star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle 3s infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

#window .crossbar-h {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 7px;
  background: repeating-linear-gradient(90deg, #1a1208, #211a0a 3px, #1a1208 6px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6), 0 -1px 0 rgba(255, 200, 100, 0.08);
  z-index: 2;
  transform: translateY(-50%);
}

#window .crossbar-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 7px;
  background: repeating-linear-gradient(180deg, #1a1208, #211a0a 3px, #1a1208 6px);
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.6), inset 1px 0 rgba(255, 200, 100, 0.06);
  z-index: 2;
  transform: translateX(-50%);
}

#window .frame-sill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(180deg, #2a1e0e, #1a1208);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  z-index: 3;
}

#window .glare {
  position: absolute;
  top: 8px;
  left: 12px;
  width: 40%;
  height: 30%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
  z-index: 2;
  pointer-events: none;
}

.shelf-plank {
  height: 14px;
  background: repeating-linear-gradient(90deg, #3a2810, #3a2810 3px, #2e2008 3px, #2e2008 80px, #382610 80px, #382610 83px, #2c1e06 83px, #2c1e06 160px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 210, 120, 0.12), inset 0 2px 4px rgba(255, 180, 60, 0.06);
  margin-bottom: 0;
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(255, 200, 100, 0.1);
}

.shelf-plank::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 210, 140, 0.0), rgba(255, 210, 140, 0.18) 20%, rgba(255, 210, 140, 0.08) 60%, rgba(255, 210, 140, 0.0));
}

#app {
  position: relative;
  z-index: 1;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
}

.serif {
  font-family: var(--font-serif, 'Libre Baskerville', serif);
}

.tap:active {
  opacity: .6;
}

.header {
  padding: 28px 20px 16px;
  border-bottom: 1px solid var(--border-color, #2a2010);
  background: rgba(20, 16, 10, 0.88);
  backdrop-filter: blur(2px);
}

.inner {
  max-width: 680px;
  margin: 0 auto;
}

.tabbar {
  background: rgba(22, 17, 10, 0.95);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid var(--border-color, #2a1e0e);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.tabbar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.body {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 100px;
  position: relative;
}

.tab-btn {
  padding: 12px 14px;
  border-bottom: 2px solid transparent;
  font-size: 11px;
  letter-spacing: .5px;
  margin-bottom: -1px;
  color: var(--text-muted, #7a789a);
}

.tab-btn.on {
  color: var(--text-color, #f0ecff);
  border-bottom-color: var(--text-color, #f0ecff);
}

.sec-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sec-line {
  flex: 1;
  height: 1px;
  background: var(--border-color, #2a2010);
}

.card {
  background: var(--card-bg-unread, #17161e);
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--spine-color, #2a2840);
  border-radius: 0;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, transparent, transparent 17px, rgba(255, 255, 255, .012) 17px, rgba(255, 255, 255, .012) 18px);
  pointer-events: none;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.card-row {
  display: flex;
  align-items: stretch;
  min-height: 52px;
}

.stat-btn {
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color, #2a2010);
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.card-btn {
  flex: 1;
  padding: 10px 8px 10px 0;
  text-align: left;
  min-width: 0;
}

.card-div {
  height: 3px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0.5) 100%);
  margin-left: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.series-grp {
  background: rgba(22, 17, 10, 0.6);
  border: 1px solid var(--border-color, #2a2010);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 200, 100, 0.04);
}

.add-btn {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--border-color, #2a2010);
  border-radius: 8px;
  color: var(--text-muted, #7a789a);
  font-size: 11px;
  margin-top: 2px;
  transition: all .15s;
}

.add-btn:hover {
  border-color: var(--accent-color, #e08c2a);
  color: var(--text-color, #ddd8f0);
}

.sheet-ov {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .75);
}

.sheet {
  position: relative;
  background: var(--card-bg-unread, #17161e);
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: 32px;
  animation: up .22s ease;
  border-top: 1px solid var(--border-color, #2a2010);
}

@keyframes up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.srow {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color, #2a2010);
}

.slbl {
  font-size: 11px;
  color: var(--text-muted, #7a789a);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.sbtn {
  padding: 12px 16px;
  border: 1px solid var(--border-color, #2a2010);
  border-radius: 8px;
  font-size: 13px;
  background: transparent;
  color: var(--text-color, #ddd8f0);
  transition: all .12s;
}

.sbtn:hover:not([disabled]) {
  border-color: var(--accent-color, #e08c2a);
  color: var(--accent-color, #e08c2a);
}

.sbtn[disabled] {
  opacity: .35;
  cursor: default;
}

.form-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color, #2a2010);
  border-radius: 8px;
  padding: 16px;
  margin-top: 4px;
}

.inp {
  background: var(--bg-color, #14100c);
  border: 1px solid var(--border-color, #2a2010);
  border-radius: 6px;
  color: var(--text-color, #ddd8f0);
  padding: 10px 12px;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.inp:focus {
  border-color: var(--accent-color, #e08c2a);
}

.lbl {
  font-size: 10px;
  color: var(--text-muted, #7a789a);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
  display: block;
}

.mt {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.mb {
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-muted, #7a789a);
}

.mb.on {
  background: var(--card-bg-unread, #17161e);
  color: var(--text-color, #ddd8f0);
}

.rec {
  background: var(--card-bg-unread, #17161e);
  border: 1px solid var(--border-color, #2a2010);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.mba-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.mba-inner {
  position: relative;
  background: var(--card-bg-unread, #17161e);
  border-radius: 16px 16px 0 0;
  max-height: 80vh;
  overflow-y: auto;
  padding-bottom: 32px;
  animation: up .22s ease;
  z-index: 1;
  border-top: 1px solid var(--border-color, #2a2010);
}

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color, #e08c2a);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow, rgba(224, 140, 42, 0.4));
}

input[type=range]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color, #e08c2a);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px var(--accent-glow, rgba(224, 140, 42, 0.4));
}

/* Onboarding Tutorial CSS */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tutorial-card {
  background: var(--card-bg-unread, #17161e);
  border: 1px solid var(--accent-color, #e08c2a);
  border-radius: 12px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  animation: up .25s ease;
}

.tutorial-hdr {
  font-size: 10px;
  color: var(--accent-color, #e08c2a);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.tutorial-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color, #f0ecff);
  margin-bottom: 12px;
  line-height: 1.2;
}

.tutorial-body {
  font-size: 13px;
  color: var(--text-color, #ddd8f0);
  line-height: 1.6;
  margin-bottom: 24px;
}

.tutorial-btn-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Footer Section styling */
.info-section {
  border-top: 1px solid var(--border-color, #2a2010);
  padding: 12px 4px;
}

.info-header {
  font-size: 10px;
  color: var(--text-muted, #7a789a);
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  user-select: none;
}

.info-content {
  font-size: 11px;
  color: var(--text-muted, #7a789a);
  line-height: 1.6;
  padding: 8px 0;
}
