:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222e;
  --border: #2e2e3e;
  --accent: #7c5cbf;
  --accent2: #9b7de8;
  --win: #3eb489;
  --loss: #e05c5c;
  --draw: #8a8a9a;
  --lesson: #5b9bd5;
  --note: #d4a843;
  --text: #e8e8f0;
  --muted: #6a6a80;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.header-inner { max-width: 800px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }
.motto { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

#logout-btn {
  background: rgba(224,92,92,0.15);
  border: 1px solid var(--loss);
  color: var(--loss);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}
#logout-btn:hover { background: rgba(224,92,92,0.3); }

.header-text-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.header-text-btn:hover { color: var(--text); border-color: var(--muted); }

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.icon-btn:hover { background: var(--surface2); border-color: var(--muted); }

.tab-nav {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  max-width: 100%;
}

.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.tab:hover { color: var(--text); }

main { max-width: 800px; margin: 0 auto; padding: 1.5rem; }

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

.filters {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.filters input, .filters select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
}

.filters input { flex: 1; min-width: 180px; }

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.entry-card:hover { border-color: var(--accent); }

.entry-card-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-lesson { background: rgba(91,155,213,0.2); color: var(--lesson); }
.badge-match { background: rgba(124,92,191,0.2); color: var(--accent2); }
.badge-note { background: rgba(212,168,67,0.2); color: var(--note); }

.game-num {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-weight: 700;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  letter-spacing: 0.3px;
}

.result-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 700;
}

.result-win { background: rgba(62,180,137,0.2); color: var(--win); }
.result-loss { background: rgba(224,92,92,0.2); color: var(--loss); }
.result-draw { background: rgba(138,138,154,0.2); color: var(--draw); }

.entry-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.entry-date { color: var(--muted); font-size: 0.8rem; margin-left: auto; }

.entry-meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.entry-snippet {
  color: #9a9ab0;
  font-size: 0.83rem;
  margin-top: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-thumb {
  width: 100%;
  border-radius: 6px;
  margin-top: 0.6rem;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface2);
}

/* Form */
.entry-form { max-width: 560px; }

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-row input[type=text],
.form-row input[type=date],
.form-row input[type=url],
.form-row select,
.form-row textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
}

.form-row textarea { resize: vertical; }

.type-btns, .result-btns {
  display: flex;
  gap: 0.5rem;
}

.type-btn, .result-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s;
}

.type-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.result-btn[data-result=win].active { background: var(--win); border-color: var(--win); color: #fff; }
.result-btn[data-result=loss].active { background: var(--loss); border-color: var(--loss); color: #fff; }
.result-btn[data-result=draw].active { background: var(--draw); border-color: var(--draw); color: #fff; }

.form-actions { display: flex; gap: 0.8rem; margin-top: 1.5rem; }

.video-entry {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  position: relative;
}

.video-entry input[type=url] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
}

.video-entry textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}

.video-entry-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  display: block;
}

.btn-remove-video {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-remove-video:hover { color: var(--loss); }

.btn-add-video {
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
  margin-top: 0.2rem;
  transition: border-color 0.15s, color 0.15s;
}
.btn-add-video:hover { border-color: var(--accent2); color: var(--accent2); }

.btn-primary {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0.65rem 1.8rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent2); }

button#cancel-edit {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
}

#load-more {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.6rem 2rem;
  border-radius: var(--radius);
  cursor: pointer;
}

/* Stats */
.stats-header { margin-bottom: 1.2rem; }
.stats-header select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-num { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }
.stat-win .stat-num { color: var(--win); }
.stat-loss .stat-num { color: var(--loss); }
.stat-lesson .stat-num { color: var(--lesson); }
.stat-match .stat-num { color: var(--accent2); }

.winrate-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.bar-track {
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 0.6rem;
}

.bar-fill {
  height: 100%;
  background: var(--win);
  border-radius: 5px;
  transition: width 0.4s;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  padding: 1.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-type-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.modal-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.8rem; }
.modal-date { color: var(--muted); font-size: 0.85rem; }

.modal-match-info {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.modal-match-info span { font-size: 0.88rem; }
.modal-match-info strong { color: var(--text); }

.modal-content {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.92rem;
  color: #c0c0d0;
  margin: 0.8rem 0;
}

.modal-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.8rem; }
.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.modal-actions { display: flex; gap: 0.6rem; margin-top: 1.2rem; }

.btn-edit {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent2);
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.btn-delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--loss);
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.yt-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  border: none;
  margin: 0.4rem 0 0.8rem;
}

.video-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.6rem 0 0;
}

.video-tab-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}

.video-tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.video-desc {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  color: #c0c0d0;
  line-height: 1.7;
  margin-top: 0.4rem;
  white-space: pre-wrap;
}

.video-desc:empty { display: none; }
.video-desc blockquote { border-left: 3px solid var(--accent); padding-left: 0.8rem; margin: 0.4rem 0; color: #a0a0c0; }
.video-desc ul { padding-left: 1.2rem; margin: 0.4rem 0; }
.video-desc li { margin-bottom: 0.2rem; }
.video-desc strong { color: var(--text); }

/* 댓글 */
.comments-section { margin-top: 1.2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.comments-title { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.8rem; }
.comment-item {
  background: var(--surface2); border-radius: 8px;
  padding: 0.65rem 0.9rem; margin-bottom: 0.5rem; position: relative;
}
.comment-author { font-size: 0.78rem; font-weight: 600; color: var(--accent2); }
.comment-time { font-size: 0.72rem; color: var(--muted); margin-left: 0.5rem; }
.comment-body { font-size: 0.88rem; margin-top: 0.3rem; line-height: 1.5; }
.comment-del { position: absolute; top: 0.5rem; right: 0.6rem; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.8rem; }
.comment-form { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.comment-form textarea {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 0.55rem 0.8rem;
  font-size: 0.88rem; font-family: inherit; resize: none; min-height: 60px;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-submit {
  background: var(--accent); border: none; color: #fff;
  padding: 0 1rem; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
  align-self: flex-end; height: 38px;
}
.comment-submit:hover { background: var(--accent2); }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; font-size: 0.95rem; }

/* Day group header */
.day-group { margin-bottom: 1.4rem; }

.day-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.day-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.day-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Calendar */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.cal-nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav-btn:hover { border-color: var(--accent2); color: var(--accent2); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

#cal-body {
  grid-auto-rows: 88px;
}

.cal-dow {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.3rem 0 0.5rem;
  font-weight: 600;
}

.cal-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  position: relative;
  overflow: hidden;
  height: 88px;
}

.cal-cell.today { border-color: var(--accent2); }
.cal-cell.other-month { opacity: 0.35; }

.cal-day-num {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.cal-cell.today .cal-day-num {
  color: var(--accent2);
}

.cal-entry-pill {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: opacity 0.1s;
}
.cal-entry-pill:hover { opacity: 0.8; }

.cal-pill-lesson { background: rgba(91,155,213,0.25); color: var(--lesson); }
.cal-pill-match.win  { background: rgba(62,180,137,0.25); color: var(--win); }
.cal-pill-match.loss { background: rgba(224,92,92,0.25); color: var(--loss); }
.cal-pill-match.draw { background: rgba(138,138,154,0.25); color: var(--draw); }
.cal-pill-match      { background: rgba(124,92,191,0.2); color: var(--accent2); }
.cal-pill-note       { background: rgba(212,168,67,0.2); color: var(--note); }

.cal-more {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: right;
  margin-top: 1px;
}
