:root {
  color-scheme: dark;
  --bg: #030405;
  --surface: #111920;
  --surface-2: #1a2530;
  --surface-3: #243348;
  --line: #2d6fb5;
  --line-soft: #37536c;
  --text: #f3f6fb;
  --muted: #b7bec8;
  --accent: #f1ff19;
  --blue: #2b9dd0;
  --danger: #ff5f6d;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  touch-action: pan-y pinch-zoom;
}

button,
input {
  font: inherit;
}

button {
  color: var(--text);
}

.app-shell {
  width: 100%;
  max-width: 460px;
  max-width: min(460px, 100vw);
  min-height: 100vh;
  margin: 0 auto;
  background: #020303;
  overflow-x: hidden;
  touch-action: pan-y pinch-zoom;
}

.loader,
.empty {
  padding: 22px 16px;
  color: var(--muted);
}

.nickname-screen {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 20px;
}

.nickname-screen h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.nickname-screen p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.nickname-form {
  display: grid;
  gap: 14px;
}

.nickname-form input,
.nickname-form button {
  min-height: 46px;
  border-radius: 8px;
}

.nickname-form input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.nickname-form button,
.primary-btn,
.card-btn {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #405872 0%, #10161f 100%);
  box-shadow: 0 0 10px rgba(45, 111, 181, 0.28);
  cursor: pointer;
}

.reader-topbar {
  display: grid;
  grid-template-columns: 34px minmax(0, auto) 30px 1fr 34px 34px;
  align-items: center;
  gap: 8px;
  min-height: 55px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  position: fixed;
  top: 0;
  left: 50%;
  width: min(100%, 460px);
  max-width: 100vw;
  transform: translateX(-50%);
  z-index: 300;
}

.reader-avatar {
  width: 34px;
  height: 34px;
  border: 2px solid #273947;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 34%, #f3d19a 0 8%, transparent 9%),
    radial-gradient(circle at 62% 36%, #8e522b 0 12%, transparent 13%),
    radial-gradient(circle at 45% 62%, #e28e43 0 18%, transparent 19%),
    radial-gradient(circle at 50% 50%, #351e16 0 48%, #b97034 49% 72%, #1c252f 73%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.reader-name {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.reader-play,
.reader-icon {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.reader-play {
  width: 30px;
  height: 30px;
  position: relative;
}

.reader-play::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 13px solid #aeb0b3;
}

.reader-mini-menu {
  position: absolute;
  left: 86px;
  top: 50px;
  z-index: 160;
  min-width: 190px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 7px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48);
}

.reader-mini-menu button {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.reader-mini-menu button:active {
  background: var(--surface-2);
}

.reader-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #2d8cff;
  padding: 0;
  border-radius: 6px;
  font-size: 21px;
  line-height: 1;
}

.reader-icon:active {
  background: var(--surface-2);
}

.home-icon {
  display: block;
  width: 27px;
  height: 27px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
}

.home-icon__roof,
.home-icon__chimney,
.home-icon__body {
  fill: #d2d4d6;
}

.home-icon__door {
  fill: #18222c;
}

.top-summary {
  margin: 8px 20px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  background: radial-gradient(circle at 62% 0%, #5a6778 0%, #26354b 42%, #101721 100%);
}

.top-summary .small {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.1;
}

.top-summary .line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-size: 16px;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.top-summary .accent {
  font-size: 20px;
  font-weight: 700;
}

.top-help-btn {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.66);
  color: #394350;
  font-size: 15px;
  font-weight: 800;
  line-height: 24px;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.accent {
  color: var(--accent);
}

.segments {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 7px 8px;
  background: #101419;
}

.segment,
.tag-chip {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 0 12px;
  background: #17212b;
  color: #d6dbe2;
  white-space: nowrap;
  font-size: 12px;
}

.segment:disabled {
  opacity: 0.45;
  cursor: default;
}

.segment.active,
.tag-chip.active {
  border: 2px solid var(--accent);
  color: var(--text);
}

.profile-card,
.resume-wide,
.project-detail,
.resume-detail {
  margin: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 12px;
  background: var(--surface);
}

.portfolio-list {
  display: grid;
  gap: 12px;
  padding: 10px 8px 22px;
}

.portfolio-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 12px;
  text-align: left;
  background: var(--surface);
}

.profile-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.name {
  color: var(--accent);
  font-size: 17px;
  line-height: 1.05;
}

.role,
.muted {
  color: var(--muted);
}

.role {
  margin-top: 4px;
  font-size: 13px;
}

.help-btn,
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: #d8d8d2;
  color: #777;
  font-weight: 700;
  font-size: 18px;
}

.portfolio-link-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.portfolio-link-icon {
  width: 32px;
  height: 28px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.32));
}

.date-row {
  margin-top: 14px;
  font-size: 14px;
}

.notify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 14px;
}

.switch {
  width: 48px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #2c3642;
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f7f7f7;
  position: absolute;
  left: 2px;
  top: 2px;
  transition: transform 0.15s ease;
}

.switch.is-on {
  background: var(--blue);
}

.switch.is-on::after {
  transform: translateX(20px);
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.mini-card {
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  background: radial-gradient(circle at 50% 0%, #53677e 0%, #263549 40%, #131b25 100%);
}

.mini-card h2,
.resume-wide h2,
.section-title {
  margin: 0;
  color: var(--accent);
  font-size: 17px;
  font-weight: 500;
}

.mini-card p,
.resume-wide p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.34;
}

.mini-card .label,
.resume-wide .label {
  color: var(--muted);
  font-size: 12px;
}

.card-btn {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  border-radius: 8px;
  font-size: 15px;
}

.profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 172px);
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(circle at 45% 0%, #5a7088 0%, #2b3b50 42%, #101720 100%);
}

.portfolio-stats,
.action-buttons {
  display: grid;
  gap: 7px;
}

.portfolio-stats {
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.portfolio-stats .label {
  color: var(--muted);
  font-size: 13px;
}

.profile-actions .card-btn {
  min-height: 44px;
  margin-top: 0;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #2d4360 0%, #101822 100%);
  box-shadow: inset 0 0 16px rgba(73, 129, 191, 0.22);
}

.app-bar {
  display: grid;
  grid-template-columns: 34px 1fr 34px 34px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid #26313d;
  position: fixed;
  top: 0;
  left: 50%;
  width: min(100%, 460px);
  max-width: 100vw;
  transform: translateX(-50%);
  z-index: 300;
}

.reader-topbar + .top-summary,
.app-bar + .resume-wide,
.app-bar + .resume-detail,
.app-bar + .project-detail,
.app-bar + .notice {
  margin-top: 72px;
}

.back-btn,
.home-btn,
.refresh-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #2d8cff;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
}

.home-btn {
  color: #d8dde4;
}

.back-icon {
  display: block;
  width: 27px;
  height: 27px;
}

.back-icon path {
  fill: none;
  stroke: #d2d4d6;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bar-name {
  color: var(--accent);
  font-size: 16px;
}

.bar-role {
  color: var(--muted);
  font-size: 12px;
}

.resume-wide {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 310px);
  align-items: center;
  gap: 18px;
}

.primary-btn {
  min-height: 40px;
  border-radius: 8px;
  font-size: 14px;
}

.section {
  padding: 14px 0 0;
}

.section-title {
  padding: 0 18px 10px;
}

.tags {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px 12px;
  background: #101419;
}

.tag-chip {
  color: #b8c8d8;
  font-weight: 700;
  font-size: 13px;
}

.project-list {
  display: grid;
  gap: 10px;
  padding: 10px 8px 22px;
  background: #080a0c;
  overflow-x: hidden;
}

.project-swipe {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  touch-action: pan-y;
}

.favorite-action {
  position: absolute;
  inset: 0 0 0 auto;
  width: 33.333%;
  min-width: 92px;
  border: 1px solid #365f82;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, #2f79a8 0%, #174568 100%);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.favorite-action.is-favorite {
  background: linear-gradient(180deg, #566272 0%, #253342 100%);
  color: #d8e0ea;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 78px;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 108px;
  border: 1px solid #273a4a;
  border-radius: 14px;
  padding: 10px;
  text-align: left;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  z-index: 1;
  transition: transform 0.18s ease;
  will-change: transform;
  touch-action: pan-y;
}

.project-card-main {
  min-width: 0;
}

.project-title-line {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.project-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  flex: 0 0 auto;
  border: 1px solid #6e7b88;
  border-radius: 14px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 11px;
}

.project-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 7px;
  min-width: 88px;
  padding-top: 2px;
}

.favorite-chip {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 4px 9px;
  color: var(--accent);
  background: rgba(241, 255, 25, 0.08);
  font-size: 11px;
  white-space: nowrap;
}

.month {
  display: inline-block;
  margin-top: 10px;
  border-radius: 18px;
  padding: 3px 10px;
  background: #ffd83d;
  color: #151515;
  font-size: 12px;
  font-weight: 700;
}

.project-desc {
  margin-top: 10px;
  color: #95a2af;
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.project-tags span {
  border-radius: 14px;
  padding: 4px 8px;
  background: #10385c;
  color: #40a8ff;
  font-size: 12px;
}

.safe-metrics {
  margin-top: 10px;
  color: #9aa8b6;
  font-size: 12px;
}

.thumb {
  width: 78px;
  height: 76px;
  align-self: center;
  border-radius: 10px;
  object-fit: cover;
  background: #23303e;
}

.resume-text,
.project-text {
  margin-top: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #eef2f7;
  font-size: 14px;
  line-height: 1.45;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.media-cell {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid #273a4a;
  border-radius: 10px;
  background: #17212b;
  cursor: pointer;
}

.media-cell img,
.media-cell video {
  display: block;
  width: 100%;
  aspect-ratio: 1.1;
  object-fit: cover;
}

.media-cell-file {
  aspect-ratio: 1;
}

.media-cell-file .media-type {
  top: auto;
  bottom: 6px;
}

.doc-cell {
  width: 100%;
  height: 100%;
  min-height: 100px;
  padding: 12px 10px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
}

.doc-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 4px;
}

.doc-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
}

.doc-hint {
  max-width: 100%;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-download {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 2;
  border: 1px solid #2f80ed;
  border-radius: 8px;
  padding: 4px 8px;
  background: rgba(16, 35, 53, 0.92);
  color: #d8ebff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.doc-download:active {
  transform: translateY(1px);
}

.media-type {
  position: absolute;
  left: 6px;
  top: 6px;
  border-radius: 7px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 11px;
}

.viewer-watermark {
  position: absolute;
  z-index: 4;
  --watermark-font-scale: 16;
  max-width: 94%;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.viewer-watermark--small { --watermark-font-scale: 10; }
.viewer-watermark--medium { --watermark-font-scale: 16; }
.viewer-watermark--large { --watermark-font-scale: 24; }
@supports (font-size: 1cqw) {
  .viewer-watermark {
    font-size: clamp(10px, calc(var(--watermark-font-scale) * .42cqw), 180px);
  }
}
@supports not (font-size: 1cqw) {
  .viewer-watermark {
    font-size: clamp(10px, calc(var(--watermark-font-scale) * .08rem), 90px);
  }
}
.viewer-watermark--top_right { top: 8px; right: 8px; }
.viewer-watermark--bottom_right { right: 8px; bottom: 8px; }
.viewer-watermark--top_left { top: 8px; left: 8px; }
.viewer-watermark--bottom_left { left: 8px; bottom: 8px; }
.viewer-watermark--center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.media-file {
  display: grid;
  min-height: 86px;
  place-items: center;
  border: 1px solid #273a4a;
  border-radius: 10px;
  background: #17212b;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.media-cell-file {
  min-height: 96px;
}

.media-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.92);
  touch-action: none;
  user-select: none;
}

.media-fullscreen.hidden,
.mf-nav.hidden,
.mf-open.hidden {
  display: none !important;
}

.mf-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 501;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}

.mf-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100vw;
  max-height: 78vh;
}

.mf-media img,
.mf-media video {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 8px;
  object-fit: contain;
}

.mf-file {
  width: min(320px, 82vw);
  min-height: 120px;
}

.mf-nav {
  position: absolute;
  top: 50%;
  z-index: 502;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 72px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 36px;
  line-height: 1;
  transform: translateY(-50%);
  cursor: pointer;
}

.mf-prev {
  left: 6px;
}

.mf-next {
  right: 6px;
}

.mf-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.mf-counter {
  min-width: 42px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  text-align: center;
}

.mf-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #273a4a;
  border-radius: 8px;
  padding: 0 14px;
  background: #17212b;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.notice {
  margin: 18px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 14px;
  color: var(--muted);
  background: var(--surface);
}

.reader-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 500;
  max-width: min(360px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: rgba(20, 30, 40, 0.96);
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.reader-toast.is-error {
  border-color: #9b3b3b;
  color: #ffd9d9;
}

.error {
  color: var(--danger);
}

@media (max-width: 560px) {
  .app-shell {
    max-width: none;
  }

  .reader-topbar {
    grid-template-columns: 34px minmax(64px, auto) 30px 1fr 34px 34px;
    gap: 8px;
    min-height: 55px;
    padding: 10px 12px;
  }

  .reader-name {
    font-size: 16px;
  }

  .top-summary {
    margin: 8px 20px;
    padding: 12px 16px 11px;
  }

  .top-summary .small,
  .top-summary .line {
    font-size: 16px;
  }

  .top-summary .accent {
    font-size: 20px;
  }

  .profile-card {
    padding: 14px 12px;
  }

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

  .mini-card {
    min-height: auto;
  }

  .profile-actions {
    grid-template-columns: minmax(0, 1fr) minmax(136px, 42%);
    gap: 10px;
    padding: 11px;
  }

  .profile-actions .card-btn {
    min-height: 40px;
    font-size: 14px;
  }

  .project-card {
    grid-template-columns: minmax(0, 1fr) auto 74px;
    gap: 9px;
  }

  .project-card-badges {
    min-width: 74px;
    gap: 6px;
  }

  .thumb {
    width: 74px;
    height: 72px;
  }

  .section-title,
  .tags {
    padding-left: 18px;
    padding-right: 18px;
  }
}
