:root {
  --paper: #f5f6f3;
  --surface: #ffffff;
  --surface-soft: #eef2f0;
  --ink: #1d2a33;
  --muted: #6a7780;
  --navy: #1d5369;
  --navy-dark: #153d4e;
  --accent: #d66f4e;
  --line: #dce5e2;
  --shadow: 0 12px 32px rgba(29, 55, 65, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --focus: #f0a447;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  color: #fff;
  background: var(--navy-dark);
  border-radius: 8px;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-top: 5px solid var(--accent);
  background: var(--surface);
}

.hero-shell {
  width: min(100% - 32px, 1500px);
  margin: 0 auto;
  padding: 24px 0 28px;
}

.hero-image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #284b59;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 42px rgba(29, 55, 65, 0.16);
}

.hero-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: clamp(24px, 6vw, 72px) clamp(20px, 5vw, 70px) clamp(22px, 4vw, 52px);
  color: #fff;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 29, 37, 0.2) 25%, rgba(10, 29, 37, 0.88) 100%);
}

.hero-overlay .eyebrow {
  margin-bottom: 8px;
  color: #ffe0b0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.hero-overlay h1 {
  max-width: none;
  margin-bottom: 4px;
  font-size: clamp(1.75rem, 4.4vw, 3.35rem);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.hero-overlay > p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(0.9rem, 1.8vw, 1.15rem);
  font-weight: 700;
}

.header-shell,
.selection-bar__inner,
.main-shell {
  width: min(100% - 32px, 1500px);
  margin: 0 auto;
}

.header-shell {
  padding: 34px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 880px;
  margin-bottom: 10px;
  font-size: clamp(1.75rem, 3.2vw, 2.7rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.auth-panel {
  max-width: 760px;
  margin: 0 auto 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-panel__inner {
  padding: clamp(24px, 5vw, 42px);
}

.auth-kicker {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.auth-panel h2 {
  margin-bottom: 8px;
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  line-height: 1.35;
}

.auth-lead {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form label {
  color: var(--navy-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.password-row {
  display: flex;
  gap: 10px;
}

.password-row input {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 46px;
  padding: 9px 13px;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid #b8cbc8;
  border-radius: 10px;
}

.password-row input::placeholder {
  color: #9aa8ab;
}

.password-row input:disabled {
  color: #7b8588;
  background: #edf0ef;
  border-color: #d5ddda;
  cursor: not-allowed;
}

.password-row .button {
  flex: 0 0 auto;
  min-width: 126px;
}

.auth-message {
  margin: 13px 0 0;
  color: var(--navy-dark);
  font-size: 0.84rem;
}

.auth-message.is-error {
  padding: 10px 12px;
  color: #8c3727;
  background: #fff1ed;
  border: 1px solid #f1c8bb;
  border-radius: 10px;
}

.authenticated-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  padding: 11px 13px 11px 16px;
  color: var(--navy-dark);
  background: #edf4f1;
  border: 1px solid #d5e5df;
  border-radius: 12px;
}

.authenticated-bar p {
  margin-bottom: 0;
  font-size: 0.84rem;
}

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 14px;
}

.gallery-heading .eyebrow {
  margin-bottom: 5px;
}

.gallery-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.25;
}

.gallery-heading__note {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.gallery-area {
  min-width: 0;
}

.selection-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(29, 55, 65, 0.06);
  backdrop-filter: blur(14px);
}

.selection-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 12px 0;
}

.selection-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.summary-main {
  color: var(--navy-dark);
  font-weight: 800;
}

.summary-sub {
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-sub + .summary-sub::before {
  margin-right: 12px;
  color: var(--line);
  content: "•";
}

.selection-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.button-primary:hover:not(:disabled) {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
}

.button-secondary {
  color: var(--navy);
  background: var(--surface);
  border-color: #b8cbc8;
}

.button-secondary:hover:not(:disabled) {
  color: var(--navy-dark);
  background: var(--surface-soft);
  border-color: var(--navy);
}

.button-danger {
  color: #fff;
  background: #b64231;
  border-color: #b64231;
}

.button-danger:hover:not(:disabled) {
  background: #8c3727;
  border-color: #8c3727;
}

.button:disabled {
  color: #a3adaf;
  background: #edf0ef;
  border-color: #e3e8e6;
}

.button-small {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 0.82rem;
}

.main-shell {
  padding: 24px 0 56px;
}

.quick-guide {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 22px;
  padding: 10px 14px;
  color: var(--navy-dark);
  background: #edf4f1;
  border: 1px solid #d5e5df;
  border-radius: 12px;
  font-size: 0.88rem;
}

.quick-guide p {
  margin-bottom: 0;
}

.quick-guide strong {
  margin-right: 5px;
}

.quick-guide__mark {
  display: grid;
  flex: 0 0 25px;
  place-items: center;
  width: 25px;
  height: 25px;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.status {
  margin: 24px 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.status.is-error {
  padding: 13px 15px;
  color: #8c3727;
  background: #fff1ed;
  border: 1px solid #f1c8bb;
  border-radius: 12px;
}

.photo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.photo-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 3px 12px rgba(29, 55, 65, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.photo-card:hover {
  border-color: #b8cbc8;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.photo-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(214, 111, 78, 0.18), var(--shadow);
}

.photo-card__visual {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8edeb;
}

.photo-card__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.photo-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-card__select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(210, 222, 219, 0.95);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(17, 39, 48, 0.16);
}

.photo-card__checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.photo-card__meta {
  padding: 11px 13px 13px;
}

.photo-card__name {
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card__size {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.empty-state {
  padding: 42px 22px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.15rem;
}

.empty-state p {
  margin-bottom: 0;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 25, 31, 0.84);
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 1500px);
  height: min(94vh, 1000px);
  overflow: hidden;
  color: #fff;
  background: #14262f;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.35);
}

.lightbox__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 12px 16px 8px;
}

.lightbox__position,
.lightbox__hint {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox__stage {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
  padding: 4px 14px 12px;
}

.lightbox__visual {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
}

.lightbox__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox__nav {
  display: grid;
  place-items: center;
  width: 48px;
  height: 64px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 3rem;
  font-weight: 300;
  line-height: 1;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox__caption {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px 11px 14px;
  color: #fff;
  background: rgba(13, 25, 31, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.lightbox__details {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.lightbox__details strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox__details span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.75rem;
}

.lightbox__hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 16px 14px;
  text-align: center;
}

.download-warning {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 25, 31, 0.74);
}

.download-warning__backdrop {
  position: absolute;
  inset: 0;
}

.download-warning__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  padding: clamp(22px, 5vw, 34px);
  color: #5f241b;
  background: #fff7f5;
  border: 2px solid #c9503d;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.download-warning__panel .eyebrow {
  color: #b64231;
}

.download-warning__panel h2 {
  margin-bottom: 10px;
  color: #6d291f;
  font-size: clamp(1.25rem, 4vw, 1.7rem);
  line-height: 1.35;
}

.download-warning__message {
  margin-bottom: 22px;
  color: #6d4139;
  font-size: 0.94rem;
  white-space: pre-line;
}

.download-warning__actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 15px;
  color: #fff;
  background: #183d4c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 35, 43, 0.25);
  font-size: 0.86rem;
}

.toast.is-error {
  background: #8c3727;
}

.site-footer {
  padding: 22px 16px 30px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.site-footer p {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .photo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1200px) {
  .photo-grid {
    gap: 20px;
  }
}

@media (max-width: 700px) {
  .hero-shell {
    width: min(100% - 24px, 1500px);
    padding: 14px 0 20px;
  }

  .hero-image-wrap {
    border-radius: 15px;
  }

  .hero-overlay {
    padding: 34px 18px 20px;
  }

  .hero-overlay .eyebrow {
    margin-bottom: 5px;
    font-size: 0.62rem;
  }

  .hero-overlay h1 {
    font-size: clamp(1.35rem, 7vw, 2rem);
  }

  .hero-overlay > p:last-child {
    font-size: 0.82rem;
  }

  .header-shell,
  .selection-bar__inner,
  .main-shell {
    width: min(100% - 24px, 1500px);
  }

  .header-shell {
    padding: 26px 0 22px;
  }

  .auth-panel {
    margin-bottom: 24px;
    border-radius: 15px;
  }

  .auth-panel__inner {
    padding: 22px 18px 24px;
  }

  .password-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .password-row .button {
    width: 100%;
  }

  .authenticated-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 14px;
  }

  .authenticated-bar .button {
    width: 100%;
  }

  .gallery-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    margin-top: 2px;
  }

  .gallery-heading__note {
    text-align: left;
  }

  .selection-bar__inner {
    display: grid;
    gap: 10px;
    padding: 10px 0;
  }

  .selection-summary {
    gap: 2px 9px;
  }

  .selection-actions {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  }

  .selection-actions #clear-selection {
    grid-column: 1 / -1;
  }

  .button {
    min-height: 44px;
    padding-right: 10px;
    padding-left: 10px;
    font-size: 0.82rem;
  }

  .quick-guide {
    align-items: flex-start;
    margin-bottom: 16px;
    font-size: 0.82rem;
  }

  .lightbox {
    padding: 8px;
  }

  .lightbox__panel {
    height: min(96vh, 900px);
    border-radius: 15px;
  }

  .lightbox__stage {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 3px;
    padding: 2px 6px 8px;
  }

  .lightbox__nav {
    width: 32px;
    height: 52px;
    font-size: 2.2rem;
  }

  .lightbox__caption {
    right: 5px;
    bottom: 6px;
    left: 5px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .lightbox__details strong {
    font-size: 0.76rem;
  }

  .lightbox__caption .button {
    width: 100%;
  }

  .download-warning {
    padding: 12px;
  }

  .download-warning__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-warning__actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
