.field-group {
  min-width: 0;
  margin-top: 18px;
}

input {
  width: 100%;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 0.9375rem;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 52px;
}

input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

.visually-hidden-file {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-pill {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 12%, var(--md-sys-color-surface));
  color: var(--success);
  font-size: 0.8125rem;
  font-weight: 700;
}

.status-pill.is-finished {
  background: var(--danger-container);
  color: var(--danger);
}

.btn--finish {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}

.room-title {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.expire-text {
  margin: 8px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.connection-status {
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.connection-status--idle {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface-variant);
  border-color: var(--md-sys-color-outline-variant);
}

.connection-status--online {
  background: color-mix(in srgb, var(--success) 10%, var(--md-sys-color-surface));
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 28%, var(--md-sys-color-outline-variant));
}

.connection-status--reconnecting {
  background: #fff8e1;
  color: #8a5a00;
  border-color: #f3d37a;
}

.connection-status--offline {
  background: var(--danger-container);
  color: var(--danger);
  border-color: var(--danger-outline);
}

.qr-preview {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  text-align: center;
}

.admin-qr-preview {
  margin-top: 20px;
}

#admin-qr-code {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
}

#admin-qr-code img,
#admin-qr-code canvas {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
}

.qr-preview p {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.qr-actions {
  justify-content: center;
  margin-top: 14px;
}

.join-area,
.new-room-area,
.upload-panel,
.photo-panel,
.participants-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.new-room-area h3,
.upload-panel h3,
.photo-panel h3 {
  margin: 0 0 6px;
  color: var(--md-sys-color-on-surface);
  font-size: 1rem;
}

.new-room-area p,
.upload-panel p {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.6;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 28px 18px;
  border: 2px dashed color-mix(in srgb, var(--md-sys-color-primary) 45%, var(--md-sys-color-outline-variant));
  border-radius: var(--md-sys-shape-corner-large);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 36%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.04s ease;
}

.drop-zone:hover,
.drop-zone:focus {
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 62%, var(--md-sys-color-surface));
  border-color: var(--md-sys-color-primary);
  outline: none;
}

.drop-zone.is-dragover {
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 78%, var(--md-sys-color-surface));
  border-color: var(--md-sys-color-primary);
  transform: translateY(1px);
}

.drop-zone .material-symbols-outlined {
  color: var(--md-sys-color-primary);
  font-size: 36px;
}

.drop-zone strong {
  font-size: 0.95rem;
}

.drop-zone small {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
}

.selected-file-name {
  margin-top: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.75rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.photo-area {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.participants-panel__header,
.photo-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.participants-panel__header h3 {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-size: 1rem;
}

.participants-count {
  color: var(--md-sys-color-on-surface);
  font-size: 1rem;
  font-weight: 700;
}

.participants-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 0.8125rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.participant-chip__admin {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
}

.photo-summary {
  margin: 2px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.photo-card {
  overflow: hidden;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.photo-card__link {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

.photo-card__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--md-sys-color-surface-variant);
}

.photo-card__download-icon {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 38px;
  block-size: 38px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.photo-card__download-icon .material-symbols-outlined {
  font-size: 22px;
}

.photo-card__body {
  padding: 10px 12px 12px;
}

.photo-card__meta {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  font-weight: 600;
}

.upload-panel .tool-error,
.photo-area .tool-error {
  margin-top: 18px;
}

.empty-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  text-align: center;
}

@media (max-width: 600px) {
  input {
    padding: 12px 10px;
    font-size: 0.875rem;
    min-height: 48px;
  }

  .room-header {
    display: block;
  }

  .room-header .btn {
    margin-top: 14px;
    width: 100%;
  }

  .qr-actions .btn,
  .new-room-area .btn,
  .upload-panel .btn {
    width: 100%;
  }

  .photo-list {
    grid-template-columns: 1fr;
  }
}