* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  color: #000;
  background: #fff;
}

a { color: #03c; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 13px; }

/* ---------- masthead ---------- */

.masthead-wrap { border-bottom: 1px solid #e8e8e8; }

.masthead {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 12px 8px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo { display: inline-flex; align-items: baseline; gap: 1px; position: relative; flex: none; }
.logo:hover { text-decoration: none; }
.logo-emra { font-size: 24px; font-weight: bold; color: #333; letter-spacing: -1px; }
.logo-tube {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  background: #c4302b;
  border-radius: 5px;
  padding: 0 5px 2px;
  letter-spacing: -1px;
}
.logo-tag {
  position: absolute;
  right: 0;
  bottom: -11px;
  font-size: 9px;
  color: #999;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.search-form { display: flex; flex: 1; max-width: 460px; }
.search-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #b6b6b6;
  border-right: 0;
  padding: 5px 8px;
  font-size: 14px;
  border-radius: 2px 0 0 2px;
}
.search-form input:focus { outline: none; border-color: #888; }
.search-btn {
  border: 1px solid #b6b6b6;
  background: #f0f0f0;
  background: linear-gradient(#f8f8f8, #e0e0e0);
  padding: 0 16px;
  border-radius: 0 2px 2px 0;
}
.search-btn:active { background: #ddd; }

.masthead-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.signin-link { font-size: 12px; }
.me-name { font-size: 12px; font-weight: bold; color: #333; }

/* ---------- buttons ---------- */

.btn10 {
  display: inline-block;
  background: linear-gradient(#fcfcfc, #e0e0e0);
  border: 1px solid #aaa;
  border-radius: 2px;
  padding: 4px 12px;
  font-size: 12px;
  color: #333;
  white-space: nowrap;
}
.btn10:hover { border-color: #888; text-decoration: none; }
.btn10:active { background: #e0e0e0; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); }
.btn10[disabled] { opacity: 0.5; cursor: default; }

.btn-upload {
  background: linear-gradient(#fefad3, #f5e469);
  border-color: #c9b23c;
  font-weight: bold;
}

.btn-subscribe {
  background: linear-gradient(#fee13d, #fdb72d);
  border: 1px solid #c69a06;
  font-weight: bold;
  color: #000;
  padding: 4px 14px;
}
.btn-subscribe.subscribed {
  background: linear-gradient(#fcfcfc, #e0e0e0);
  border-color: #aaa;
  font-weight: normal;
  color: #666;
}

/* ---------- category nav ---------- */

.catnav-wrap { background: #f2f2f2; border-top: 1px solid #e8e8e8; border-bottom: 1px solid #ddd; }
.catnav {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
}
.catnav a {
  padding: 7px 12px;
  font-size: 12px;
  color: #333;
  white-space: nowrap;
}
.catnav a:hover { background: #e6e6e6; text-decoration: none; }
.catnav a.active { background: #fff; font-weight: bold; border-left: 1px solid #ddd; border-right: 1px solid #ddd; }

/* ---------- layout ---------- */

.page { max-width: 960px; margin: 0 auto; padding: 14px 12px 40px; min-height: 60vh; }

.section-head {
  background: #f2f2f2;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: bold;
  color: #333;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
}
.section-head:first-child { margin-top: 0; }
.section-head .see-all { margin-left: auto; font-weight: normal; font-size: 11px; }

/* ---------- video grid ---------- */

.vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 16px 14px;
}

.vcell { min-width: 0; }
.vthumb-wrap { position: relative; display: block; background: #000; }
.vthumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #111;
}
.vdur {
  position: absolute;
  right: 3px;
  bottom: 3px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 0 4px;
  border-radius: 1px;
}
.vtitle {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.25;
  color: #03c;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.vmeta { font-size: 11px; color: #666; margin-top: 3px; line-height: 1.4; }
.vmeta a { color: #666; }
.vmeta a:hover { color: #03c; }

/* ---------- search results rows ---------- */

.vrow { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eee; }
.vrow .vthumb-wrap { width: 160px; flex: none; }
.vrow-info { min-width: 0; }
.vrow-title { font-size: 15px; }
.vrow-snippet { font-size: 12px; color: #444; margin-top: 4px; }

/* ---------- watch page ---------- */

.watch-grid { display: flex; gap: 20px; }
.watch-main { flex: 1; min-width: 0; }
.watch-side { width: 300px; flex: none; }

.watch-title { font-size: 19px; font-weight: bold; margin: 0 0 8px; line-height: 1.25; }

.uploader-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 10px;
}
.sq-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  flex: none;
}
.uploader-name { font-weight: bold; font-size: 13px; }
.uploader-subs { font-size: 11px; color: #666; }

.player-box { background: #000; position: relative; }
.player-box video { width: 100%; display: block; max-height: 480px; background: #000; }
.end-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 16px;
}
.end-overlay .big { font-size: 17px; font-weight: bold; }
.end-overlay .sub { font-size: 13px; color: #ccc; }
.end-overlay a { color: #9cf; }

.stats-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #e5e5e5;
  padding: 8px 0;
  flex-wrap: wrap;
}
.views-big { font-size: 16px; color: #333; font-weight: bold; }
.views-big span { font-weight: normal; font-size: 12px; color: #666; }
.stats-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.rate-wrap { display: flex; flex-direction: column; gap: 3px; }
.rate-btns { display: flex; gap: 4px; }
.rate-btn { display: inline-flex; align-items: center; gap: 5px; }
.rate-btn.active-up { color: #16711c; border-color: #16711c; font-weight: bold; }
.rate-btn.active-down { color: #a33; border-color: #a33; font-weight: bold; }
.rate-bar { height: 5px; display: flex; border-radius: 2px; overflow: hidden; background: #ccc; }
.rate-bar .green { background: #16711c; }
.rate-bar .red { background: #b04141; }

.desc-box {
  background: #f7f7f7;
  border: 1px solid #e2e2e2;
  border-radius: 2px;
  padding: 10px 12px;
  margin: 10px 0 4px;
  font-size: 12px;
  color: #333;
}
.desc-date { color: #666; margin-bottom: 6px; }
.desc-text { white-space: pre-wrap; overflow-wrap: break-word; }
.desc-text.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.show-more { font-size: 11px; margin-top: 6px; display: inline-block; }
.cat-line { font-size: 11px; color: #666; margin-top: 8px; }

/* ---------- comments ---------- */

.comments-head { margin-top: 18px; }
.comments-sort { margin-left: auto; font-weight: normal; font-size: 11px; }
.comments-sort a { margin-left: 8px; }
.comments-sort a.cur { font-weight: bold; color: #333; }

.comment-composer { display: flex; gap: 10px; margin: 10px 0 16px; }
.comment-composer textarea {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 2px;
  padding: 6px 8px;
  min-height: 34px;
  resize: vertical;
}
.comment-composer textarea:focus { outline: none; border-color: #888; }
.composer-actions { margin-top: 6px; display: flex; gap: 6px; }

.c-item { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid #eee; }
.c-body { min-width: 0; flex: 1; }
.c-head { font-size: 11px; color: #666; }
.c-head .c-author { font-weight: bold; font-size: 12px; }
.c-text { font-size: 13px; margin: 3px 0 4px; white-space: pre-wrap; overflow-wrap: break-word; }
.c-actions { font-size: 11px; color: #666; display: flex; align-items: center; gap: 10px; }
.c-actions button { border: 0; background: none; padding: 0; font-size: 11px; color: #03c; }
.c-actions button:hover { text-decoration: underline; }
.c-actions .voted { font-weight: bold; color: #16711c; }
.c-actions .voted-down { font-weight: bold; color: #a33; }
.c-score { color: #666; }
.c-replies { margin-left: 34px; }
.c-replies .c-item { border-top: 1px dotted #e5e5e5; }
.reply-box { margin: 6px 0 8px; }
.reply-box textarea { width: 100%; border: 1px solid #ccc; border-radius: 2px; padding: 5px 7px; min-height: 30px; resize: vertical; }

/* ---------- sidebar ---------- */

.side-head { font-size: 12px; font-weight: bold; color: #333; border-bottom: 2px solid #999; padding-bottom: 4px; margin-bottom: 8px; }
.side-row { display: flex; gap: 8px; margin-bottom: 10px; }
.side-row .vthumb-wrap { width: 120px; flex: none; }
.side-info { min-width: 0; }
.side-title {
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.side-meta { font-size: 11px; color: #666; margin-top: 2px; }

/* ---------- channel page ---------- */

.channel-head {
  border: 1px solid #ddd;
  border-radius: 2px;
  background: linear-gradient(#fdfdfd, #f0f0f0);
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.channel-name { font-size: 20px; font-weight: bold; }
.channel-tagline { font-size: 12px; color: #666; font-style: italic; margin-top: 2px; }
.channel-stats { font-size: 11px; color: #666; margin-top: 4px; }
.channel-actions { margin-left: auto; }

/* ---------- modal / toast ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal10 {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid #999;
  border-radius: 3px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
.modal10-title {
  background: linear-gradient(#f8f8f8, #e8e8e8);
  border-bottom: 1px solid #ccc;
  padding: 8px 12px;
  font-weight: bold;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.modal10-close { margin-left: auto; border: 0; background: none; font-size: 14px; color: #666; }
.modal10-body { padding: 14px; }
.modal10-body .field { margin-bottom: 10px; }
.modal10-body input[type='text'], .modal10-body input[type='password'] {
  width: 100%;
  border: 1px solid #bbb;
  border-radius: 2px;
  padding: 6px 8px;
}
.form-error { color: #a33; font-size: 11px; min-height: 14px; margin-bottom: 6px; }
.auth-switch { font-size: 11px; color: #666; margin-top: 10px; }
.upload-modal-text { font-size: 13px; line-height: 1.5; color: #333; }
.upload-modal-text .waffles { font-size: 34px; text-align: center; margin: 8px 0; }

#toast-root {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.toast10 {
  background: #ffc;
  border: 1px solid #cc9;
  color: #333;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- footer ---------- */

.footer { border-top: 1px solid #e5e5e5; margin-top: 30px; }
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 12px 40px;
  text-align: center;
  font-size: 11px;
  color: #999;
  line-height: 1.8;
}

.empty10 { text-align: center; color: #666; padding: 50px 10px; font-size: 13px; }
.empty10 .big { font-size: 30px; margin-bottom: 8px; }

/* ---------- responsive ---------- */

@media (max-width: 800px) {
  .watch-grid { flex-direction: column; }
  .watch-side { width: auto; }
  .logo-tag { display: none; }
  .masthead { gap: 10px; flex-wrap: wrap; }
  .search-form { order: 3; flex-basis: 100%; max-width: none; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 10px; }
  .player-box video { max-height: none; }
}
