:root {
  --primary: #1a73e8;
  --bg-dark: #0f172a;
  --card-bg: #1e293b;
  --text-light: #f8fafc;
  --accent: #f43f5e;
  --border: #334155;
  --input-bg: #0f172a;
}

body {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  margin: 0;
}

#app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nav */
.top-nav {
  padding: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--accent);
}

/* Tabs */
.tab-menu {
  display: flex;
  gap: 8px;
  padding: 1rem;
}

.tab-btn {
  flex: 1;
  background: var(--card-bg);
  color: #94a3b8;
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Form Styles */
.input-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-field label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.input-field input {
  width: 100%;
  box-sizing: border-box;
  background: var(--input-bg);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  color: white;
}

/* Toggle Switch */
.toggle-field {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* Grid & Cards */
.card {
  background: var(--card-bg);
  margin: 1rem;
  padding: 1.5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.grid-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 1rem;
}

.item-card {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.item-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.item-info {
  padding: 12px;
  font-size: 13px;
}

.item-name {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 14px;
}

.item-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: bold;
}

.warning-text {
  font-size: 11px;
  color: var(--accent);
  margin-top: 8px;
  font-weight: 500;
}

.win { color: #10b981; }
.loss { color: var(--accent); }

.item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-delete {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background-color: var(--card-bg);
  border-radius: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 10;
}

.close-modal {
  font-size: 24px;
  cursor: pointer;
  color: #94a3b8;
}

.history-list {
  padding: 20px;
}

.history-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  background: #0f172a;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.history-video-thumb {
  width: 80px;
  height: 80px;
  background: #334155;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #94a3b8;
  flex-shrink: 0;
}

.history-info {
  flex: 1;
}

.history-result {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 4px;
}

.history-date {
  font-size: 11px;
  color: #64748b;
}

.item-img-container {
  position: relative;
  cursor: pointer;
}

.item-img-container:after {
  content: "기록 보기";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 12px;
  font-weight: bold;
}

.item-img-container:hover:after {
  opacity: 1;
}


.toggle-label {
  font-size: 11px;
  color: #94a3b8;
}

/* Small toggle for gallery */
.switch-sm {
  width: 34px;
  height: 20px;
}
.switch-sm .slider:before {
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
}
input:checked + .switch-sm .slider:before { transform: translateX(14px); }


/* Common */
.btn-primary, .btn-battle {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
}

.btn-primary { background: var(--primary); color: white; }
.btn-battle { background: linear-gradient(45deg, var(--accent), #e11d48); color: white; margin-top: 10px; }

.image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: #0f172a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  border: 2px dashed var(--border);
  margin-top: 1.5rem;
}

.loading-spinner {
  width: 30px; height: 30px;
  border: 3px solid rgba(255,255,255,0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Shared with Login */
.centered-view { flex: 1; display: flex; justify-content: center; align-items: center; padding: 20px; }
.login-card { background: var(--card-bg); padding: 3rem 2rem; border-radius: 24px; text-align: center; width: 100%; }
.btn-google { width: 100%; padding: 14px; background: white; color: #3c4043; border-radius: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; border: none; }
.status-msg { text-align: center; margin-top: 1rem; color: #94a3b8; font-size: 13px; }
