@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./assets/fonts/Pretendard-Regular.woff2') format('woff2');
}

:root {
  --bg-dark: #000000;
  --surface: #121317;
  --surface-solid: #131418;
  --surface-2: #1a1c21;
  --surface-3: #22252b;
  --border: #272a31;
  --border-strong: #3c4049;
  --text-main: #ececee;
  --text-muted: #9a9ea6;
  --accent: #d2313c;
  --green: #2f9e5f;
  --orange: #d1912f;
  --red: #cc4b4b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-weight: 400;
  font-synthesis: none;
  line-height: 1.45;
  word-break: keep-all;
  touch-action: manipulation;
}

button,
input,
select,
textarea,
h1,
h2,
h3,
strong {
  font-family: inherit;
  font-weight: 400;
  font-synthesis: none;
}

.hidden {
  display: none !important;
}

.control-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 20px 28px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 15px;
}

.dot-pill.optional {
  opacity: 0.45;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
}

.dot.green {
  background: var(--green);
}

.dot.orange {
  background: var(--orange);
}

.dot.red {
  background: var(--red);
}

.dot-dl {
  font-size: 11px;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.conn-pill {
  padding: 6px 12px;
  border-radius: 8px;
  background: #331a1d;
  border: 1px solid #5b2529;
  font-size: 12px;
  color: #eecfd1;
}

.settings-hold-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
}

.hold-ring {
  position: absolute;
  inset: 0;
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}

.hold-ring-bg {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 2.5;
}

.hold-ring-fg {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 150.8;
  stroke-dashoffset: 150.8;
}

.gear-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  pointer-events: none;
}

.corner-gear-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.corner-gear-btn:hover,
.corner-gear-btn:active {
  opacity: 0.95;
}

.corner-gear-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.server-tab-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.play-btn {
  position: relative;
  width: clamp(320px, 68vw, 560px);
  height: clamp(260px, 52vh, 380px);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: #101114;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s ease, border-color 0.2s ease;
  touch-action: none;
}

.play-btn.holding {
  transform: scale(0.97);
}

.play-btn.ready {
  opacity: 1;
  border-color: var(--border-strong);
}

.play-btn.playing {
  opacity: 1;
  border-color: var(--accent);
}

.play-btn.disabled {
  cursor: not-allowed;
}

.play-icon-img {
  position: relative;
  z-index: 1;
  width: clamp(160px, 32vh, 236px);
  height: clamp(160px, 32vh, 236px);
  object-fit: contain;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.play-action-hint {
  position: relative;
  z-index: 1;
  font-size: clamp(17px, 2.3vh, 21px);
  font-weight: 400;
  color: var(--text-main);
  pointer-events: none;
}

.play-btn.disabled .play-icon-img {
  opacity: 0.4;
}

.play-btn.disabled .play-action-hint {
  color: var(--text-muted);
}

.play-ring {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.play-ring-bg {
  fill: none;
  stroke: #2b2e35;
  stroke-width: 6;
}

.play-ring-fg {
  fill: none;
  stroke: #ffffff;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}

.play-icon {
  position: relative;
  z-index: 1;
  line-height: 1;
}

.cooldown-label {
  padding: 5px 12px;
  border-radius: 8px;
  background: #0f1013;
  border: 1px solid var(--border);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timeline-track {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: #262930;
  pointer-events: none;
}

.timeline-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  transform: translate(-50%, -50%);
}

.time-text {
  min-width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 500;
}

.action-row {
  display: flex;
  justify-content: center;
}

.msg-btn {
  padding: 13px 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 16px;
  border-radius: 8px;
  background: #1a1c21;
  border: 1px solid var(--border);
  font-size: 13px;
}

/* Message Bottom Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet {
  width: 100%;
  max-width: 720px;
  max-height: 84vh;
  overflow-y: auto;
  padding: 20px 24px 26px;
  border-radius: 14px 14px 0 0;
  background: var(--surface-solid);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-header h2 {
  margin: 0;
  font-size: 18px;
}

.close-x {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-main);
  font-size: 16px;
  cursor: pointer;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.preset-choice-btn {
  padding: 15px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #17181d;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.custom-msg-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.custom-msg-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0d10;
  color: var(--text-main);
  font-size: 15px;
  -webkit-user-select: text;
  user-select: text;
}

.confirm-caption {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.confirm-preview {
  padding: 18px;
  border-radius: 8px;
  background: #0c0d10;
  border: 1px solid #5b2529;
  color: #f0dcdc;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 14px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions > button {
  flex: 1;
  padding: 14px;
}

/* Modals & Settings */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-card h2 {
  margin: 0;
  font-size: 18px;
}

.modal-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.server-pill {
  padding: 7px 10px;
  border-radius: 6px;
  background: #0c0d10;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.modal-card input,
.settings-card input,
.settings-card select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0d10;
  color: var(--text-main);
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
}

.modal-card input[type="password"] {
  text-align: center;
  font-size: 18px;
}

.modal-card input[type="url"] {
  text-align: left;
  font-size: 14px;
}

.server-override {
  font-size: 12px;
  color: var(--text-muted);
}

.server-override summary {
  cursor: pointer;
}

.server-override-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions > button {
  flex: 1;
}

.error-text {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  color: #e79a9a;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  padding: 11px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.primary-btn {
  background: #ececee;
  color: #0b0c0e;
  border-color: transparent;
}

.secondary-btn {
  background: var(--surface-2);
  color: var(--text-main);
}

.danger-btn {
  background: #3a181c;
  color: #f2c9cb;
  border-color: #6e2429;
}

.small {
  padding: 7px 12px;
  font-size: 13px;
}

/* Settings Panel */
.settings-panel {
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-header h2 {
  margin: 0;
  font-size: 19px;
}

.settings-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  background: #0b0c0f;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text-main);
}

.settings-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.device-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.settings-card {
  padding: 16px;
  border-radius: 10px;
  background: #101114;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card h3 {
  margin: 0;
  font-size: 15px;
}

.card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.muted-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.detail-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.detail-dl dt {
  color: var(--text-muted);
}

.detail-dl dd {
  margin: 0;
  font-weight: 500;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  color: var(--text-muted);
}

.offset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-editor-list,
.video-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preset-edit-row input {
  flex: 1;
}

.video-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 8px;
  background: #0c0d10;
  border: 1px solid var(--border);
  font-size: 13px;
}

.video-item.active {
  border-color: #2b5a3c;
  background: rgba(47, 158, 95, 0.06);
}

.video-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 220px;
}

.video-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  word-break: break-all;
}

.video-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  flex-shrink: 0;
}

.video-badge.active {
  background: rgba(47, 158, 95, 0.16);
  color: #8fd0a8;
}

.video-badge.archived {
  background: #26282e;
  color: #b7bac1;
}

.video-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.upload-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sr-only-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-strong);
  background: #0c0d10;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: #6a6f79;
  background: #14161b;
}

.upload-dropzone.has-file {
  border-style: solid;
  border-color: #3c7a55;
  background: rgba(47, 158, 95, 0.06);
}

.upload-dropzone-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.upload-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.upload-dropzone-title {
  font-size: 15px;
  color: var(--text-main);
  word-break: break-all;
}

.upload-dropzone-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.upload-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-progress-track {
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: #1f2126;
  overflow: hidden;
}

.upload-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 0.15s linear;
}

.video-preview-player {
  width: 100%;
  max-height: 280px;
  border-radius: 8px;
  background: #000000;
}

.modal-backdrop.top-popup {
  z-index: 60;
}

.friendly-error-card {
  max-width: 360px;
  text-align: center;
}

.friendly-error-desc {
  font-size: 15px;
  color: var(--text-main);
}

.logs-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.log-filter-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #101114;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.log-filter-btn.active {
  background: var(--surface-3);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.log-entry {
  padding: 10px 12px;
  border-radius: 8px;
  background: #0c0d10;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.log-entry.error {
  border-color: #5b2529;
  background: #191114;
}

.log-entry.warn {
  border-color: #57431f;
  background: #191510;
}

.log-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.log-entry-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.log-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}

.log-badge.error {
  background: #3a1a1d;
  color: #e7b8bb;
}

.log-badge.warn {
  background: #352a14;
  color: #e3c98f;
}

.log-badge.info {
  background: #16222e;
  color: #a9c7dd;
}

.log-entry-detail {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}
