﻿:root {
  color-scheme: light;
  --bg-1: #f7f0e8;
  --bg-2: #f2e6d6;
  --bg-3: #fff8ef;
  --ink-1: #1f1a16;
  --ink-2: #5e5148;
  --accent-1: #f4b45e;
  --accent-2: #f07e55;
  --accent-3: #9dd5c6;
  --panel: rgba(255, 255, 255, 0.78);
  --stroke: rgba(31, 26, 22, 0.12);
  --shadow: 0 22px 60px rgba(45, 34, 25, 0.18);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --focus: 0 0 0 3px rgba(240, 126, 85, 0.25);
  --grad-1: radial-gradient(circle at 10% 20%, rgba(244, 180, 94, 0.24), transparent 45%);
  --grad-2: radial-gradient(circle at 85% 10%, rgba(157, 213, 198, 0.3), transparent 50%);
  --grad-3: radial-gradient(circle at 50% 90%, rgba(240, 126, 85, 0.18), transparent 52%);
  --sidebar-w: 450px;
  --sidebar-collapsed-w: 80px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Gowun Batang", "Nanum Myeongjo", "Apple SD Gothic Neo", serif;
  background: linear-gradient(140deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  color: var(--ink-1);
  min-height: 100vh;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20% -10% auto auto;
  width: 60vw;
  height: 60vw;
  background: var(--grad-1), var(--grad-2), var(--grad-3);
  filter: blur(0px);
  z-index: -1;
  transform: translate3d(0, 0, 0);
}

body::after {
  inset: auto auto -30% -10%;
  width: 55vw;
  height: 55vw;
  opacity: 0.8;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  padding: 32px 14px;
}

.sidebar-toggle {
  position: absolute;
  right: -15px;
  top: 24px;
  width: 30px;
  height: 30px;
  background: var(--accent-1);
  border: 1px solid var(--accent-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 120;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  transform: scale(1.1);
  background: var(--accent-2);
  color: #fff;
}

.sidebar-toggle .toggle-icon {
  font-size: 14px;
  transition: transform 0.4s ease;
  color: var(--ink-1);
}

.sidebar.collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

/* Hide content when collapsed */
.sidebar.collapsed .sidebar-header .brand,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .inline-add-container {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Brand icon hidden as per new design */
.brand-icon {
  display: none;
}

.sidebar.collapsed .brand-icon {
  display: block;
  /* Show only when collapsed as a fallback icon if needed, or hide completely if desired */
  font-weight: 900;
  font-size: 24px;
  color: var(--accent-2);
  text-align: center;
  margin-bottom: 32px;
}

.sidebar:not(.collapsed) .sidebar-header .brand,
.sidebar:not(.collapsed) .sidebar-section,
.sidebar:not(.collapsed) .sidebar-footer {
  opacity: 1;
  transition: opacity 0.4s ease 0.2s;
}

.sidebar-header {
  margin-bottom: 32px;
}

.brand {
  font-weight: 800;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink-1);
  margin-top: 8px;
}

.sidebar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 4px;
  background: rgba(31, 26, 22, 0.04);
  border-radius: var(--radius-md);
}

.tab-btn {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--panel);
  color: var(--ink-1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  margin-bottom: 12px;
  font-weight: 600;
}

.tab-content.hidden {
  display: none;
}

/* Ranking List */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(31, 26, 22, 0.04);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.rank-item:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: translateX(4px);
  border-color: var(--accent-1);
}

.rank-avatar {
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.rank-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rank-badge {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-1);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  flex-shrink: 0;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-job {
  font-size: 11px;
  color: var(--ink-2);
}

.rank-damage {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-2);
  text-align: right;
}

.ranking-filter {
  margin-bottom: 16px;
}

.dropdown-filter {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-filter:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: var(--focus);
}

.loading {
  padding: 20px;
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
}

/* Changelog Styling */
.changelog-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 4px 20px 4px;
}

.update-item {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.update-item:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--accent-1);
}

.update-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.update-date {
  font-size: 11px;
  color: var(--ink-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.update-version {
  font-size: 13px;
  font-weight: 900;
  color: var(--accent-2);
  background: rgba(240, 126, 85, 0.1);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(240, 126, 85, 0.2);
}

.tag-group {
  margin-bottom: 12px;
}

.tag-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.tag-added {
  background: rgba(44, 110, 73, 0.1);
  color: #2c6e49;
}

.tag-changed {
  background: rgba(244, 180, 94, 0.2);
  color: #92400e;
}

.tag-fixed {
  background: rgba(155, 47, 47, 0.1);
  color: #9b2f2f;
}

.update-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}

.update-list li {
  margin-bottom: 4px;
  position: relative;
  padding-left: 14px;
}

.update-list li::before {
  content: '??;
 position: absolute;
  left: 0;
  color: var(--accent-2);
  font-weight: 900;
}

/* Character List */
.character-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
  /* Space for scrollbar */
}

.char-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(31, 26, 22, 0.06);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
  position: relative;
}

.char-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
}

.char-item-edit,
.char-item-delete {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(31, 26, 22, 0.1);
  opacity: 1;
  /* Always visible */
  position: static;
  /* Override absolute */
  transform: none;
  /* Override transform */
}

.char-item-edit {
  background: white;
  color: var(--ink-2);
}

.char-item-delete {
  background: white;
  color: #dc2626;
}

.char-item-edit:hover {
  background: var(--accent-1);
  color: white;
  border-color: var(--accent-1);
}

.char-item-delete:hover {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

.char-item:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.char-item.active {
  background: linear-gradient(135deg, rgba(244, 180, 94, 0.2), rgba(240, 126, 85, 0.1));
  border-color: rgba(240, 126, 85, 0.3);
  box-shadow: 0 4px 12px rgba(240, 126, 85, 0.1);
}

.char-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.char-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.char-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-job {
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.2;
}

.char-damage {
  font-size: 16px;
  font-weight: 900;
  color: var(--accent-2);
  margin-left: auto;
  padding-right: 62px;
  /* 踰꾪듉 洹몃９怨?諛李⑸맂 媛꾧꺽 ?좎? */
  flex-shrink: 0;
}

.char-item.add-new {
  justify-content: center;
  background: transparent;
  border: 1px dashed rgba(31, 26, 22, 0.2);
  color: var(--ink-2);
  font-size: 13px;
  padding: 12px;
}

.char-item.add-new:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(240, 126, 85, 0.05);
}

/* Inline Add UI */
.inline-add-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.inline-add-container.active {
  max-height: 800px;
  opacity: 1;
  padding: 20px 16px;
  margin-bottom: 20px;
}

.inline-add-container .field {
  margin-bottom: 4px;
}

.inline-add-container .selector-label {
  margin: 12px 0 8px 0;
}

.inline-add-footer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.inline-add-footer button {
  padding: 10px;
  font-size: 13px;
}

.inline-subclass-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.inline-subclass-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.inline-subclass-card.active {
  background: var(--accent-1);
  border-color: var(--accent-2);
}

.inline-subclass-card .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.inline-subclass-card .name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Minimize list effect */
.character-list.minimized {
  max-height: 120px;
  /* Further reduced height */
  overflow-y: auto;
  gap: 4px;
  /* Tighter gap */
}

.character-list.minimized .char-item {
  padding: 6px 10px;
  /* Much smaller padding */
  opacity: 0.5;
}

.character-list.minimized .char-item.active {
  opacity: 1;
  border-color: var(--accent-2);
}

.character-list.minimized .char-avatar {
  width: 24px;
  /* Shrunk avatar */
  height: 24px;
  font-size: 12px;
}

.character-list.minimized .char-job {
  display: none;
  /* Hide job name to save space */
}

.character-list.minimized .char-title {
  font-size: 12px;
  /* Smaller font */
}

.character-list.minimized .char-item-edit {
  width: 20px;
  height: 20px;
  font-size: 10px;
  right: 8px;
}

/* Sidebar Footer styles moved to Main Button Section for consolidation */

/* Main Content */
.main-content {
  flex: 1;
  padding: 40px 48px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 32px;
  animation: float-in 0.8s ease-out;
}

.page-header h1 {
  font-size: 32px;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
}

/* Columns Grid - 3 Column Layout */
.columns {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  animation: rise-in 0.8s ease-out;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 126, 85, 0.16);
  color: var(--ink-1);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.group {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(31, 26, 22, 0.08);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--ink-1);
}

.group-title span {
  font-weight: 600;
}

/* Standard Preset Highlight */
/* Standard Preset Highlight */
.preset-row.is-standard {
  background: #fff0d4 !important;
  /* Clearly distinctive light orange */
  border: 2px solid #fb923c !important;
  /* Orange-400 */
  box-shadow: 0 4px 12px rgba(251, 146, 60, 0.25);
}

.preset-row.is-standard.active {
  background: rgba(244, 180, 94, 0.35) !important;
  border-color: var(--accent-2) !important;
  box-shadow: 0 0 0 2px var(--accent-2) !important;
}

.preset-row.is-standard .preset-name {
  color: #c05621 !important;
  /* Strong Orange-Brown */
  font-weight: 800 !important;
}

/* Edit Hint for Preset Name */
.preset-name {
  position: relative;
  cursor: text;
  border-bottom: 1px dashed transparent;
  transition: all 0.2s;
  padding-left: 18px;
  /* Space for icon */
}

.preset-name::before {
  content: '✎';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--ink-2);
  opacity: 0.5;
}

.preset-name:hover {
  border-bottom-color: var(--ink-2);
}

.preset-name:focus {
  outline: none;
  border-bottom-color: var(--accent-2);
  background: rgba(255, 255, 255, 0.5);
}

.preset-name:focus::before {
  opacity: 1;
  color: var(--accent-2);
}

.preset-row.is-standard .preset-val {
  color: #c05621 !important;
}

.preset-row.is-standard::after {
  content: '기준';
  position: absolute;
  top: -10px;
  right: -6px;
  background: var(--accent-2);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 2;
}



.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

input[type="number"],
input[type="text"] {
  appearance: textfield;
  border: 1px solid rgba(31, 26, 22, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: "Gowun Batang", "Nanum Myeongjo", "Apple SD Gothic Neo", serif;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  width: 100%;
}

input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: var(--focus);
  transform: translateY(-1px);
}

.hint {
  font-size: 12px;
  color: rgba(31, 26, 22, 0.6);
  margin-top: 8px;
}

.unit-field {
  position: relative;
  display: flex;
  align-items: center;
}

.unit-field .unit {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: rgba(31, 26, 22, 0.6);
  pointer-events: none;
}

.unit-field input {
  padding-right: 26px;
  width: 100%;
}

/* Result Panel */
.result-panel {
  position: sticky;
  top: 40px;
}

.result-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid rgba(31, 26, 22, 0.12);
  margin-bottom: 12px;
}

.result-card.accent {
  background: linear-gradient(135deg, rgba(244, 180, 94, 0.45), rgba(240, 126, 85, 0.25));
  border-color: rgba(240, 126, 85, 0.4);
}

.result-label {
  font-size: 12px;
  color: rgba(31, 26, 22, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.result-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-1);
}

.result-value-wrapper {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.compare-toggle {
  background: rgba(31, 26, 22, 0.08);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
  font-family: inherit;
}

.compare-toggle.active {
  background: var(--accent-2);
  color: #fff;
}

.compare-diff {
  font-size: 16px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  animation: slide-in 0.4s ease-out;
}

.compare-diff.plus {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
}

.compare-diff.minus {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.compare-diff.hidden {
  display: none;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(157, 213, 198, 0.22);
  color: var(--ink-1);
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-weight: 600;
}

button.primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #1b120c;
  box-shadow: 0 12px 26px rgba(240, 126, 85, 0.35);
}

button.ghost {
  background: rgba(31, 26, 22, 0.06);
  color: var(--ink-1);
}

/* Sidebar Footer */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center content */
  gap: 0;
  /* Gap handled by individual margins for precise control */
  padding-top: 24px;
  border-top: 1px solid var(--stroke);
  margin-top: auto;
}

#auth-status {
  margin-bottom: 12px;
  font-size: 14px;
  color: #666;
  font-weight: 500;
  text-align: center;
}

/* Override error color for auth status only if needed, but we removed 'error' class in JS */
#auth-status.error {
  color: #dc2626;
}

#auth-status.success {
  color: #2c6e49;
  margin-bottom: 12px;
  /* Ensure spacing when logged in too */
}

.auth-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.btn-google {
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  width: 100%;
  max-width: 320px;
  /* Updated to 320px as recommended */
  margin: 0 auto;
  padding: 12px;
  /* Ensure sufficient touch target */
}

.btn-google:hover {
  background: #fff;
  border-color: #d2e3fc;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.15);
  transform: translateY(-1px);
}

.privacy-policy {
  margin-top: 16px;
  text-align: center;
}

.privacy-policy a {
  font-size: 12px;
  color: #999;
  /* Neutral gray */
  text-decoration: underline;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.privacy-policy a:hover {
  opacity: 1;
  color: var(--accent-2);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.footer-note {
  font-size: 12px;
  color: rgba(31, 26, 22, 0.6);
  margin-top: 16px;
  line-height: 1.4;
}

.save-status {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(31, 26, 22, 0.7);
}

.save-status.success {
  color: #2c6e49;
}

.save-status.error {
  color: #9b2f2f;
}

/* Animations */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 1440px) {
  .columns {
    grid-template-columns: 1fr 1fr;
  }

  /* Make Status and Result stack if needed, or keep 2 cols */
  .panel:nth-child(3) {
    grid-column: span 2;
  }
}

@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
    padding: 16px 20px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  .sidebar-header {
    margin: 0;
  }

  .sidebar-section {
    display: none;
    /* Hide char list on mobile header for now */
  }

  .main-content {
    padding: 24px 20px;
  }

  .columns {
    grid-template-columns: 1fr;
  }

  .panel:nth-child(3) {
    grid-column: span 1;
  }

  .result-panel {
    position: static;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 26, 22, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 900px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--ink-2);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.close-modal:hover {
  background: rgba(31, 26, 22, 0.05);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.modal-footer {
  display: flex;
  gap: 12px;
}

/* Job Selector Styles */
.job-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(31, 26, 22, 0.03);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 26, 22, 0.06);
}

.selector-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.class-buttons {
  display: flex;
  flex-direction: row;
  /* Force horizontal direction */
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.class-btn {
  padding: 6px 12px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 26, 22, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  /* Prevent vertical text wrapping */
  width: auto;
  flex: 0 0 auto;
  /* Prevent shrinking */
}

.class-btn:hover {
  background: var(--accent-1);
  color: white;
  border-color: var(--accent-1);
}

/* Character List Footer Actions */
.char-list-footer {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 16px;
}

.char-list-footer .char-item {
  width: auto;
  flex: 1 1 0;
  padding: 8px 2px;
  font-size: 13px;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  min-width: 0;
  text-align: center;
}

/* Stat Efficiency Display */
.stat-eff {
  font-size: 11px;
  min-height: 16px;
  margin-top: 4px;
  color: var(--ink-2);
  font-weight: 600;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.stat-eff.active {
  opacity: 1;
  color: var(--ink-1);
}

.stat-eff.best {
  color: #db2777;
  /* Pink-600 */
  font-weight: 900;
  position: relative;
  padding-left: 14px;
}

.stat-eff.best::before {
  content: '★';
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 10px;
  color: #db2777;
}

/* Efficiency Table Modal */
.eff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.eff-table th {
  padding: 10px;
  border-bottom: 2px solid var(--stroke);
  color: var(--ink-2);
  font-weight: 700;
  background: rgba(31, 26, 22, 0.03);
}

.eff-table td {
  padding: 10px;
  border-bottom: 1px solid var(--stroke);
  color: var(--ink-1);
}

.eff-table tr:last-child td {
  border-bottom: none;
}

.eff-table tr:hover td {
  background: rgba(31, 26, 22, 0.02);
}

.eff-highlight {
  color: var(--accent-2);
  font-weight: 700;
}

/* Preset List */

/* Efficiency Bar Visualization */
.eff-bar-container {
  width: 80px;
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
}

.eff-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.eff-bar.high {
  background: #2ecc71;
}

/* Green for high efficiency */
.eff-bar.med {
  background: #f1c40f;
}

/* Yellow for medium */
.eff-bar.low {
  background: #e74c3c;
}

/* Red for low */

/* Main Header */
.main-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--stroke);
}

.header-top {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 24px;
}

.header-left {
  flex-shrink: 0;
}

.header-title {
  margin: 0;
  font-size: 20px;
  color: var(--ink-1);
}

.header-desc {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 4px;
  display: block;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  /* Push to right if presets are hidden/empty */
}

/* Preset Container in Header */
.preset-container {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  flex: 1;
  /* Take up remaining space */
  min-width: 0;
  /* Enable scrolling inside flex item */
  /* Horizontal Scroll layout */
  overflow-x: auto;
  gap: 12px;
  padding: 12px 0 12px 0;
  /* padding bottom for scrollbar */
  background: transparent;
  border: none;
  max-height: none;
  margin: 0;
  /* Remove old margins */
}

.preset-container::-webkit-scrollbar {
  height: 6px;
}

.preset-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.preset-row.is-standard {
  border: 1px solid var(--accent-1);
  background: rgba(244, 180, 94, 0.05);
}

.preset-row.is-standard::after {
  content: "기준";
  position: absolute;
  top: -8px;
  right: -4px;
  background: var(--accent-1);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preset-row {
  /* Compact Vertical Card Style */
  flex: 0 0 auto;
  min-width: 135px;
  /* Allow shrinking but keep minimum */
  width: auto;
  /* Snap to content */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--stroke);
  padding: 8px 10px;
  /* Reduced vertical padding */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  position: relative;
  border-radius: var(--radius-sm);
  gap: 6px;
}

.preset-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.preset-info {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.preset-name {
  font-size: 12px;
  color: var(--ink-2);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.preset-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.preset-diff {
  font-size: 12px;
  font-weight: 600;
}

.preset-del {
  margin-left: auto;
  /* Push to end */
  font-size: 16px;
  padding: 2px 6px;
  line-height: 1;
  color: var(--ink-2);
  background: transparent;
  border: none;
  border-radius: 4px;
  opacity: 0.6;
}

/* Preset selection states */
.preset-row.active {
  background: #fff;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 2px var(--accent-1);
}

.preset-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.preset-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  background: #f0f0f0;
  transition: all 0.2s;
}

.preset-row.active .preset-radio {
  background: var(--accent-1);
  border-color: var(--accent-1);
}

.preset-vals-col {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  /* Align siblings to the left */
  gap: 6px;
  /* Small gap between damage and diff */
  width: 100%;
}


.preset-row {
  cursor: pointer;
}

.preset-row.add-new {
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--stroke);
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  color: var(--ink-2);
  gap: 4px;
}

.preset-row.add-new:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--accent-2);
  color: var(--accent-2);
  transform: translateY(-2px);
}

.preset-add-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.preset-add-text {
  font-size: 13px;
  font-weight: 700;
}

.preset-diff.plus {
  color: #2e7d32;
  /* Green */
}

.preset-diff.minus {
  color: #ed6c02;
  /* Orange */
}