    :root {
      /* Existing AD&D theme variables (dark defaults) */
      --bg: #1c1f2b;
      --panel: #232739;
      --accent: #4fd1c5;
      --accent-light: #81e6d9;
      --text: #f1f5f9;
      --muted: #94a3b8;
      --border: rgba(255,255,255,0.08);
      --glass: rgba(255,255,255,0.04);

      /* Added to support the Passphrase file’s toggle UI sizing/colors */
      --toggleHeight: 16em;
      --toggleWidth: 30em;
      --toggleBtnRadius: 10em;
      --bgColor--night: #423966;
      --mooncolor: #d9fbff;
      --bgColor--day: #9ee3fb;
    }

    *{box-sizing:border-box}
    html, body {
      min-height: 100vh;
      margin: 0;
      font-family:'Segoe UI',Roboto,Arial,sans-serif;
      background: var(--bg);
      color: var(--text);
      background-attachment: fixed; /* ensures bg covers viewport even while scrolling */
      transition: background-color 0.5s ease, color 0.5s ease;
    }
    .wrap{max-width:1200px;margin:0 auto;padding:24px}
    header{
      display:flex;
      align-items:center;
      justify-content:space-between;
      padding-bottom:12px;
      border-bottom:1px solid var(--border);
      transition: color 0.5s ease, border-color 0.5s ease;
    }
	header h1{
	  margin:0;
	  font-size:26px;
	  font-family: 'Metamorphous', serif;
	  color:var(--accent-light);
	  transition: color 0.5s ease;
	  letter-spacing: 1px;
	}
	header .small{
	  font-size:13px;
	  color:var(--muted);
	  transition: color 0.5s ease;
	}

	.subtitle{
	  font-size:14px;
	  color:var(--muted);
	  font-style:italic;
	  text-align:left;
	  margin-top:4px;
	  transition: color 0.5s ease;
	}

    /* Top Tabs */
    .tabs{
      display:flex;
      gap:6px;
      margin-top:10px;
      border-bottom:1px solid var(--border);
      align-items:end;
      transition: border-color 0.5s ease;
    }
    .tab{
      padding:6px 12px;
      background:var(--glass);
      border-radius:6px 6px 0 0;
      cursor:pointer;
      user-select:none;
      transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
      border-bottom: 2px solid transparent; /* baseline so it can transition */
    }
    .tab.active{
      background:var(--panel);
      border-bottom:2px solid var(--accent-light);
    }
    .tab .close{margin-left:6px;color:var(--muted);cursor:pointer;transition: color 0.5s ease;}
    .tab .label{pointer-events:none;transition: color 0.5s ease;}
    .tab-content{display:none}
    .tab-content.active{display:block}
    /* UNSAVED INDICATOR */
    .tab.unsaved .label::after{ content:" •"; color:var(--accent-light); }

    /* Layout / cards */
    .grid{display:grid;grid-template-columns:2fr 1fr;gap:20px;margin-top:10px}
    .card{
      background:var(--panel);
      padding:16px;
      border-radius:10px;
      box-shadow:0 6px 18px rgba(0,0,0,0.4);
      border:1px solid var(--border);
      transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
    }
    label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px;transition: color 0.5s ease;}
    input[type=text], input[type=number], textarea, select{
      width:100%;
      padding:8px;
      border-radius:6px;
      border:1px solid var(--border);
      background:#1a1d29;
      color:inherit;
      transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
    }
    textarea{min-height:80px;resize:vertical}
    .row{display:flex;gap:8px}
    .row .col{flex:1}
    .buttons{display:flex;gap:8px;flex-wrap:wrap}
    button{
      background:var(--accent);
      color:#1a202c;
      padding:8px 12px;
      border-radius:8px;
      border:none;
      cursor:pointer;
      font-weight:600;
      transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    }
    button:hover{background:var(--accent-light)}
    .ghost{
      background:var(--glass);
      color:var(--text);
      transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    }
    .section{margin-bottom:16px}
	.section h3{
	  margin:0 0 8px 0;
	  display:flex;
	  align-items:center;
	  justify-content:space-between;
	  font-size:18px;
	  font-family: 'Almendra', serif;
	  font-weight: 700;
	  color:var(--accent-light);
	  transition: color 0.5s ease;
	  letter-spacing: 0.5px;
	}
    .list{margin-top:8px}
    .item{
      display:flex;
      gap:8px;
      align-items:flex-start;
      padding:8px;
      border-radius:8px;
      background:rgba(255,255,255,0.03);
      margin-bottom:8px;
      transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
    }
    .item input, .item textarea{background:transparent;border:none;border-bottom:1px solid var(--border);outline:none;color:inherit}
    .small{font-size:13px;color:var(--muted);transition: color 0.5s ease;}
    .right-card{position:sticky;top:20px}
    .avatar{
      width:100%;
      height:240px;
      display:flex;
      align-items:center;
      justify-content:center;
      border-radius:8px;
      background:rgba(255,255,255,0.04);
      overflow:hidden;
      transition: background-color 0.5s ease, border-color 0.5s ease;
    }
    .avatar img{max-width:100%;max-height:100%;object-fit:contain}
    .controls{display:flex;gap:8px;margin-top:8px}
    .stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
    .stat{
      padding:8px;
      border-radius:8px;
      background:rgba(255,255,255,0.05);
      text-align:center;
      transition: background-color 0.5s ease, color 0.5s ease;
    }
    .stat input{font-weight:700;text-align:center}
    footer{
      margin-top:24px;
      color:var(--muted);
      font-size:13px;
      text-align:center;
      border-top:1px solid var(--border);
      padding-top:12px;
      transition: color 0.5s ease, border-color 0.5s ease;
    }
    .file-input{display:none}
    .sidebar-message{display:none;margin-top:12px;font-size:13px;color:var(--accent-light);text-align:center;transition: color 0.5s ease;}
    
	/* === MOBILE DRAWER SYSTEM === */
	/* Hide drawer controls on desktop */
	.drawer-toggle,
	.drawer-backdrop {
	   display: none;
	}

	@media (max-width:900px){
	  .grid{grid-template-columns:1fr}
	  
	  /* Hide sidebar normally on mobile, show as drawer */
	  .right-card {
		position: fixed;
		top: 0;
		right: -320px; /* Hidden off-screen */
		width: 300px;
		max-width: 85vw;
		height: 100vh;
		overflow-y: auto;
		z-index: 5000;
		transition: right 0.3s ease;
		margin: 0;
		border-radius: 0;
		box-shadow: -4px 0 12px rgba(0,0,0,0.5);
	  }
	  
	  /* When drawer is open */
	  .right-card.drawer-open {
		right: 0;
	  }
	  
	  /* Drawer toggle button */
	  .drawer-toggle {
		display: block;
		position: fixed;
		top: 50%;
		right: 0;
		transform: translateY(-50%);
		background: var(--accent);
		color: #1a202c;
		border: none;
		border-radius: 6px 0 0 6px;
		padding: 8px 12px;
		cursor: pointer;
		font-weight: 700;
		font-size: 18px;
		z-index: 4999;
		box-shadow: -2px 2px 8px rgba(0,0,0,0.3);
		transition: background-color 0.3s ease, right 0.3s ease;
	  }
	  
	  .drawer-toggle:hover {
		background: var(--accent-light);
	  }
	  
	  /* Move toggle when drawer is open */
	  .drawer-toggle.drawer-open {
		right: 300px;
	  }
	  
	  /* Overlay backdrop when drawer is open */
	  .drawer-backdrop {
		display: none; /* Hidden by default even on mobile */
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0,0,0,0.5);
		z-index: 4998;
	  }
	  
	  .drawer-backdrop.active {
		display: block;
	  }
	}

    /* === Light mode (mirrors the second file’s theme intent) === */
	body.light{
	  --bg: #faf8f3;              /* Warm cream */
	  --panel: #ffffff;
	  --accent: #d9764a;          /* Lighter burnt orange */
	  --accent-light: #c85a3f;    /* Terracotta for hover */
	  --text: #2d2520;            /* Warm black */
	  --muted: #8b7355;           /* Tan/brown muted */
	  --border: rgba(139,69,19,0.15);
	  --glass: rgba(139,69,19,0.05);
	}

    body.light .card{
      background: var(--panel);
      border: 1px solid var(--border);
      box-shadow: 0 6px 16px rgba(0,0,0,0.10);
    }
    body.light input[type=text],
    body.light input[type=number],
    body.light textarea,
    body.light select{
      background:#f9f9f9;
      color: var(--text);
      border-color: var(--border);
    }
    body.light .avatar{ background: rgba(0,0,0,0.04); }
    body.light .item{ background: rgba(0,0,0,0.03); }

    /* === Toggle control (identical UI from the second file) === */
    .tdnn {
      cursor: pointer;
      font-size: 10%;
      position: fixed;
      top: 17em;
      right: 10em;
      height: var(--toggleHeight);
      width: var(--toggleWidth);
      border-radius: var(--toggleHeight);
      transition: all 500ms ease-in-out;
      background: var(--bgColor--night);
      z-index: 2000;
    }
    .day { background: #ffbf71; }
    .moon {
      position: absolute; border-radius: 50%; transition: all 400ms ease-in-out;
      top: 3em; left: 3em; transform: rotate(-75deg);
      width: var(--toggleBtnRadius); height: var(--toggleBtnRadius);
      background: var(--bgColor--night);
      box-shadow: 3em 2.5em 0 0em var(--mooncolor) inset,
        rgba(255,255,255,0.1) 0em -7em 0 -4.5em,
        rgba(255,255,255,0.1) 3em 7em 0 -4.5em,
        rgba(255,255,255,0.1) 2em 13em 0 -4em;
    }
    .sun { top: 4.5em; left: 18em; transform: rotate(0deg); width: 7em; height: 7em; background: #fff; }

    @media (max-width: 768px){
      .tdnn { top: auto; bottom: 1.25rem; right: 1.25rem; font-size: 12%; }
    }

    /* === Vertical tabs (new) === */
    .sheet-body {
      display: flex;
      align-items: flex-start;
    }
    .vtab-bar {
      display: flex;
      flex-direction: column;
      margin-right: 12px;
    }
    .vtab {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      padding: 8px 6px;
      margin-bottom: 6px;
      background: var(--glass);
      border-radius: 6px;
      cursor: pointer;
      text-align: center;
      font-size: 12px;
      user-select: none;
    }
    .vtab.active {
      background: var(--accent);
      color: #000;
      font-weight: 700;
    }
	/* Combat Round Tracker */
    .next-round-btn {
      background: var(--accent);
      color: #1a202c;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      font-weight: 600;
      transition: background-color 0.3s ease;
    }
    .next-round-btn:hover {
      background: var(--accent-light);
    }
    .reset-round-btn {
      background: var(--glass);
      color: var(--text);
      border: none;
      border-radius: 6px;
      cursor: pointer;
      transition: background-color 0.3s ease;
    }
    .reset-round-btn:hover {
      background: rgba(255, 255, 255, 0.08);
    }
    
    /* Condition/Status Tracker */
    .condition-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 4px 6px;
      margin-bottom: 4px;
      background: rgba(255, 255, 255, 0.05);
      border-radius: 4px;
      font-size: 11px;
      transition: background-color 0.2s;
      cursor: pointer;
    }
    .condition-item:hover {
      background: rgba(255, 255, 255, 0.08);
    }
    .condition-item:hover .condition-tooltip {
      display: block;
    }
    .condition-name {
      flex: 1;
      color: var(--text);
    }
    .condition-duration {
      color: var(--muted);
      margin: 0 6px;
      font-size: 10px;
    }
    .condition-remove {
      background: transparent;
      border: none;
      color: var(--muted);
      cursor: pointer;
      padding: 0 4px;
      font-size: 14px;
      line-height: 1;
      transition: color 0.2s;
    }
    .condition-remove:hover {
      color: var(--accent-light);
    }
    .condition-tooltip {
      position: absolute;
      display: none;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 8px;
      font-size: 11px;
      line-height: 1.4;
      max-width: 250px;
      z-index: 1000;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
      pointer-events: none;
      margin-left: -260px;
      margin-top: -20px;
    }
  
    .vtab-content { display: none; flex: 1; }
    .vtab-content.active { display: block; }
	textarea {
	  overflow-y: hidden;
	  resize: none; /* optional: prevent manual resize handles */
	}
	.attack-matrix-table {
	  border-collapse: collapse;
	  width: 100%;
	  font-size: 11px;
	  text-align: center;
	  margin-top: 6px;
	}
	.attack-matrix-table th,
	.attack-matrix-table td {
	  border: 1px solid var(--border);
	  padding: 2px 4px;
	}
	/* Highlight both the AC header and the cell on hover */
	.attack-matrix-table td:hover,
	.attack-matrix-table th:hover {
	  background: rgba(255,255,255,0.1);
	  cursor: help;
	}
	body.light .attack-matrix-table td:hover,
	body.light .attack-matrix-table th:hover {
	  background: rgba(0,0,0,0.08);
	}
	.attack-matrix-table th {
	  background: var(--glass);
	  color: var(--muted);
	}
	.base-thac0 {
	  margin: 4px 0;
	  font-weight: 600;
	  color: var(--accent-light);
	}
	input[readonly] {
	  background: rgba(255,255,255,0.05);
	}
	/* Generic highlight for auto-modified fields */
	input.auto-bonus {
	  box-shadow: 0 0 4px rgba(0, 200, 255, 0.6);
	  border-color: rgba(0, 200, 255, 0.8);
	}
	/* === Saving Throws Section === */
	.saving-throws .save-pair { display: block; }

	/* Labels row: save label + "+/-" label sit side-by-side */
	.saving-throws .labels {
	  display: flex;
	  align-items: flex-end;
	  gap: 8px;
	  margin-bottom: 4px;
	}

	/* Make the main save label line up with the wide save input */
	.saving-throws .save-label { flex: 1; }

	/* Make the "+/-" label same width as the mod input so it aligns */
	.saving-throws .mod-label {
	  width: 4.5em;           /* matches mod input */
	  text-align: left;
	  font-size: 12px;
	  color: var(--muted);
	}

	/* Inputs row: wide save + narrow mod, side-by-side */
	.saving-throws .inputs {
	  display: flex;
	  gap: 8px;
	}

	/* Restore normal full-width save box */
	.saving-throws .save-input {
	  flex: 1;
	  width: 100%;
	  box-sizing: border-box;
	  text-align: left; /* or center if you prefer */
	}

	/* Compact mod box */
	.saving-throws .mod-input {
	  width: 4.5em;
	  text-align: center;
	  box-sizing: border-box;
	}
	
	/* Thief points allocation collapsible content */
	.thief-points-content {
	  max-height: 2000px;
	  overflow: hidden;
	  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
	  opacity: 1;
	}

	.thief-points-content.collapsed {
	  max-height: 0;
	  opacity: 0;
	  margin: 0;
	  padding: 0;
	}

	/* Collapsible Follower Items */
    .item.collapsible {
      background: var(--glass);
      border: 1px solid var(--border);
      border-radius: 6px;
      margin-bottom: 8px;
      overflow: hidden;
    }
    
    .item-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 12px;
      background: rgba(255, 255, 255, 0.03);
      cursor: pointer;
      user-select: none;
    }
    
    .item-header:hover {
      background: rgba(255, 255, 255, 0.05);
    }
    
    .item-title {
      font-weight: 600;
      color: var(--text);
      font-size: 14px;
    }
    
    .item-actions {
      display: flex;
      gap: 8px;
      align-items: center;
    }
    
    .toggle-btn {
      background: transparent;
      border: none;
      color: var(--accent);
      cursor: pointer;
      font-size: 14px;
      padding: 4px 8px;
      transition: color 0.2s;
    }
    
    .toggle-btn:hover {
      color: var(--accent-light);
    }
    
    .remove-btn {
      background: rgba(255, 100, 100, 0.2);
      border: 1px solid rgba(255, 100, 100, 0.3);
      color: #ff6b6b;
      cursor: pointer;
      padding: 4px 12px;
      border-radius: 4px;
      font-size: 12px;
      transition: all 0.2s;
    }
    
    .remove-btn:hover {
      background: rgba(255, 100, 100, 0.3);
      border-color: rgba(255, 100, 100, 0.5);
    }
    
    .item-body {
      padding: 12px;
      border-top: 1px solid var(--border);
    }
	
	/* Dormant dual-class abilities */
	.ability-dormant {
	  opacity: 0.4;
	  text-decoration: line-through;
	  font-style: italic;
	}

	.ability-dormant .ability-name {
	  color: var(--muted);
	}

	.ability-active {
	  /* Normal styling - abilities are available */
	}
	
	.slot-breakdown {
	  font-size: 10px;
	  color: var(--muted);
	  text-align: center;
	  min-height: 14px;
	  line-height: 14px;
	  margin-top: 2px;
	  word-break: break-word;
	}
